2 * Copyright 1999-2000,2004 The Apache Software Foundation.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * Revision 1.1 2004/11/23 13:38:52 lpadovan
20 * * basic infrastructure for collecting statistics
22 * Revision 1.7 2004/09/08 13:55:33 peiyongz
23 * Apache License Version 2.0
25 * Revision 1.6 2004/02/15 19:43:15 amassari
26 * Removed cause for warnings in VC 7.1
28 * Revision 1.5 2002/11/05 21:46:20 tng
29 * Explicit code using namespace in application.
31 * Revision 1.4 2002/02/01 22:40:44 peiyongz
34 * Revision 1.3 2000/10/10 23:55:55 andyh
35 * XMLFormatter patch, contributed by Bill Schindler. Fix problems with
36 * output to multi-byte encodings.
38 * Revision 1.2 2000/08/09 22:20:39 jpolast
39 * updates for changes to sax2 core functionality.
41 * Revision 1.1 2000/08/02 19:16:14 jpolast
42 * initial checkin of SAX2Print
47 #include <xercesc/sax2/DefaultHandler.hpp>
48 #include <xercesc/framework/XMLFormatter.hpp>
50 XERCES_CPP_NAMESPACE_USE
52 class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget
55 // -----------------------------------------------------------------------
57 // -----------------------------------------------------------------------
60 const char* const encodingName
61 , const XMLFormatter::UnRepFlags unRepFlags
62 , const bool expandNamespaces
67 // -----------------------------------------------------------------------
68 // Implementations of the format target interface
69 // -----------------------------------------------------------------------
72 const XMLByte* const toWrite
77 const XMLByte* const toWrite
78 , const unsigned int count
79 , XMLFormatter* const formatter
83 // -----------------------------------------------------------------------
84 // Implementations of the SAX DocumentHandler interface
85 // -----------------------------------------------------------------------
88 void endElement( const XMLCh* const uri,
89 const XMLCh* const localname,
90 const XMLCh* const qname);
92 void characters(const XMLCh* const chars, const unsigned int length);
94 void ignorableWhitespace
96 const XMLCh* const chars
97 , const unsigned int length
100 void processingInstruction
102 const XMLCh* const target
103 , const XMLCh* const data
106 void startDocument();
108 void startElement( const XMLCh* const uri,
109 const XMLCh* const localname,
110 const XMLCh* const qname,
111 const Attributes& attributes);
115 // -----------------------------------------------------------------------
116 // Implementations of the SAX ErrorHandler interface
117 // -----------------------------------------------------------------------
118 void warning(const SAXParseException& exc);
119 void error(const SAXParseException& exc);
120 void fatalError(const SAXParseException& exc);
124 // -----------------------------------------------------------------------
125 // Implementation of the SAX DTDHandler interface
126 // -----------------------------------------------------------------------
129 const XMLCh* const name
130 , const XMLCh* const publicId
131 , const XMLCh* const systemId
134 void unparsedEntityDecl
136 const XMLCh* const name
137 , const XMLCh* const publicId
138 , const XMLCh* const systemId
139 , const XMLCh* const notationName
143 // -----------------------------------------------------------------------
144 // Private data members
147 // This is the formatter object that is used to output the data
148 // to the target. It is set up to format to the standard output
150 // -----------------------------------------------------------------------
151 XMLFormatter fFormatter;