source: NonGTP/Xerces/xerces/samples/SAX2Print/SAX2PrintHandlers.hpp @ 358

Revision 358, 4.7 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
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: SAX2PrintHandlers.hpp,v $
19 * Revision 1.7  2004/09/08 13:55:33  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.6  2004/02/15 19:43:15  amassari
23 * Removed cause for warnings in VC 7.1
24 *
25 * Revision 1.5  2002/11/05 21:46:20  tng
26 * Explicit code using namespace in application.
27 *
28 * Revision 1.4  2002/02/01 22:40:44  peiyongz
29 * sane_include
30 *
31 * Revision 1.3  2000/10/10 23:55:55  andyh
32 * XMLFormatter patch, contributed by Bill Schindler.  Fix problems with
33 * output to multi-byte encodings.
34 *
35 * Revision 1.2  2000/08/09 22:20:39  jpolast
36 * updates for changes to sax2 core functionality.
37 *
38 * Revision 1.1  2000/08/02 19:16:14  jpolast
39 * initial checkin of SAX2Print
40 *
41 *
42 */
43
44#include    <xercesc/sax2/DefaultHandler.hpp>
45#include    <xercesc/framework/XMLFormatter.hpp>
46
47XERCES_CPP_NAMESPACE_USE
48
49class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget
50{
51public:
52    // -----------------------------------------------------------------------
53    //  Constructors
54    // -----------------------------------------------------------------------
55    SAX2PrintHandlers
56    (
57        const   char* const                 encodingName
58        , const XMLFormatter::UnRepFlags    unRepFlags
59                , const bool                                            expandNamespaces
60    );
61    ~SAX2PrintHandlers();
62
63
64    // -----------------------------------------------------------------------
65    //  Implementations of the format target interface
66    // -----------------------------------------------------------------------
67    void writeChars
68    (
69        const   XMLByte* const  toWrite
70    );
71
72    void writeChars
73    (
74        const   XMLByte* const  toWrite
75        , const unsigned int    count
76        , XMLFormatter* const   formatter
77    );
78
79
80    // -----------------------------------------------------------------------
81    //  Implementations of the SAX DocumentHandler interface
82    // -----------------------------------------------------------------------
83    void endDocument();
84
85    void endElement( const XMLCh* const uri,
86                                         const XMLCh* const localname,
87                                         const XMLCh* const qname);
88
89    void characters(const XMLCh* const chars, const unsigned int length);
90
91    void ignorableWhitespace
92    (
93        const   XMLCh* const    chars
94        , const unsigned int    length
95    );
96
97    void processingInstruction
98    (
99        const   XMLCh* const    target
100        , const XMLCh* const    data
101    );
102
103    void startDocument();
104
105    void startElement(  const   XMLCh* const    uri,
106                                                const   XMLCh* const    localname,
107                                                const   XMLCh* const    qname,
108                                            const   Attributes&         attributes);
109
110
111
112    // -----------------------------------------------------------------------
113    //  Implementations of the SAX ErrorHandler interface
114    // -----------------------------------------------------------------------
115    void warning(const SAXParseException& exc);
116    void error(const SAXParseException& exc);
117    void fatalError(const SAXParseException& exc);
118
119
120
121    // -----------------------------------------------------------------------
122    //  Implementation of the SAX DTDHandler interface
123    // -----------------------------------------------------------------------
124    void notationDecl
125    (
126        const   XMLCh* const    name
127        , const XMLCh* const    publicId
128        , const XMLCh* const    systemId
129    );
130
131    void unparsedEntityDecl
132    (
133        const   XMLCh* const    name
134        , const XMLCh* const    publicId
135        , const XMLCh* const    systemId
136        , const XMLCh* const    notationName
137    );
138
139private :
140    // -----------------------------------------------------------------------
141    //  Private data members
142    //
143    //  fFormatter
144    //      This is the formatter object that is used to output the data
145    //      to the target. It is set up to format to the standard output
146    //      stream.
147    // -----------------------------------------------------------------------
148    XMLFormatter    fFormatter;
149        bool                    fExpandNS ;
150};
Note: See TracBrowser for help on using the repository browser.