1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: SAXPrintHandlers.hpp,v $
|
---|
19 | * Revision 1.11 2004/09/08 13:55:34 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.10 2004/02/15 19:43:15 amassari
|
---|
23 | * Removed cause for warnings in VC 7.1
|
---|
24 | *
|
---|
25 | * Revision 1.9 2002/11/05 21:46:20 tng
|
---|
26 | * Explicit code using namespace in application.
|
---|
27 | *
|
---|
28 | * Revision 1.8 2002/02/01 22:41:17 peiyongz
|
---|
29 | * sane_include
|
---|
30 | *
|
---|
31 | * Revision 1.7 2000/10/10 23:55:59 andyh
|
---|
32 | * XMLFormatter patch, contributed by Bill Schindler. Fix problems with
|
---|
33 | * output to multi-byte encodings.
|
---|
34 | *
|
---|
35 | * Revision 1.6 2000/04/06 19:09:52 roddey
|
---|
36 | * Some more improvements to output formatting. Now it will correctly
|
---|
37 | * handle doing the 'replacement char' style of dealing with chars
|
---|
38 | * that are unrepresentable.
|
---|
39 | *
|
---|
40 | * Revision 1.5 2000/04/05 00:20:32 roddey
|
---|
41 | * More updates for the low level formatted output support
|
---|
42 | *
|
---|
43 | * Revision 1.4 2000/03/28 19:43:12 roddey
|
---|
44 | * Fixes for signed/unsigned warnings. New work for two way transcoding
|
---|
45 | * stuff.
|
---|
46 | *
|
---|
47 | * Revision 1.3 2000/03/02 19:53:49 roddey
|
---|
48 | * This checkin includes many changes done while waiting for the
|
---|
49 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
50 | * available elsewhere.
|
---|
51 | *
|
---|
52 | * Revision 1.2 2000/02/06 07:47:24 rahulj
|
---|
53 | * Year 2K copyright swat.
|
---|
54 | *
|
---|
55 | * Revision 1.1.1.1 1999/11/09 01:09:29 twl
|
---|
56 | * Initial checkin
|
---|
57 | *
|
---|
58 | * Revision 1.8 1999/11/08 20:43:42 rahul
|
---|
59 | * Swat for adding in Product name and CVS comment log variable.
|
---|
60 | *
|
---|
61 | */
|
---|
62 |
|
---|
63 |
|
---|
64 | #include <xercesc/sax/HandlerBase.hpp>
|
---|
65 | #include <xercesc/framework/XMLFormatter.hpp>
|
---|
66 |
|
---|
67 | XERCES_CPP_NAMESPACE_USE
|
---|
68 |
|
---|
69 | class SAXPrintHandlers : public HandlerBase, private XMLFormatTarget
|
---|
70 | {
|
---|
71 | public:
|
---|
72 | // -----------------------------------------------------------------------
|
---|
73 | // Constructors
|
---|
74 | // -----------------------------------------------------------------------
|
---|
75 | SAXPrintHandlers
|
---|
76 | (
|
---|
77 | const char* const encodingName
|
---|
78 | , const XMLFormatter::UnRepFlags unRepFlags
|
---|
79 | );
|
---|
80 | ~SAXPrintHandlers();
|
---|
81 |
|
---|
82 |
|
---|
83 | // -----------------------------------------------------------------------
|
---|
84 | // Implementations of the format target interface
|
---|
85 | // -----------------------------------------------------------------------
|
---|
86 | void writeChars
|
---|
87 | (
|
---|
88 | const XMLByte* const toWrite
|
---|
89 | );
|
---|
90 |
|
---|
91 | void writeChars
|
---|
92 | (
|
---|
93 | const XMLByte* const toWrite
|
---|
94 | , const unsigned int count
|
---|
95 | , XMLFormatter* const formatter
|
---|
96 | );
|
---|
97 |
|
---|
98 |
|
---|
99 | // -----------------------------------------------------------------------
|
---|
100 | // Implementations of the SAX DocumentHandler interface
|
---|
101 | // -----------------------------------------------------------------------
|
---|
102 | void endDocument();
|
---|
103 |
|
---|
104 | void endElement(const XMLCh* const name);
|
---|
105 |
|
---|
106 | void characters(const XMLCh* const chars, const unsigned int length);
|
---|
107 |
|
---|
108 | void ignorableWhitespace
|
---|
109 | (
|
---|
110 | const XMLCh* const chars
|
---|
111 | , const unsigned int length
|
---|
112 | );
|
---|
113 |
|
---|
114 | void processingInstruction
|
---|
115 | (
|
---|
116 | const XMLCh* const target
|
---|
117 | , const XMLCh* const data
|
---|
118 | );
|
---|
119 |
|
---|
120 | void startDocument();
|
---|
121 |
|
---|
122 | void startElement(const XMLCh* const name, AttributeList& attributes);
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | // -----------------------------------------------------------------------
|
---|
127 | // Implementations of the SAX ErrorHandler interface
|
---|
128 | // -----------------------------------------------------------------------
|
---|
129 | void warning(const SAXParseException& exc);
|
---|
130 | void error(const SAXParseException& exc);
|
---|
131 | void fatalError(const SAXParseException& exc);
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|
135 | // -----------------------------------------------------------------------
|
---|
136 | // Implementation of the SAX DTDHandler interface
|
---|
137 | // -----------------------------------------------------------------------
|
---|
138 | void notationDecl
|
---|
139 | (
|
---|
140 | const XMLCh* const name
|
---|
141 | , const XMLCh* const publicId
|
---|
142 | , const XMLCh* const systemId
|
---|
143 | );
|
---|
144 |
|
---|
145 | void unparsedEntityDecl
|
---|
146 | (
|
---|
147 | const XMLCh* const name
|
---|
148 | , const XMLCh* const publicId
|
---|
149 | , const XMLCh* const systemId
|
---|
150 | , const XMLCh* const notationName
|
---|
151 | );
|
---|
152 |
|
---|
153 |
|
---|
154 | private :
|
---|
155 | // -----------------------------------------------------------------------
|
---|
156 | // Private data members
|
---|
157 | //
|
---|
158 | // fFormatter
|
---|
159 | // This is the formatter object that is used to output the data
|
---|
160 | // to the target. It is set up to format to the standard output
|
---|
161 | // stream.
|
---|
162 | // -----------------------------------------------------------------------
|
---|
163 | XMLFormatter fFormatter;
|
---|
164 | };
|
---|