source: icXML/icXML-devel/samples/src/SAX2Print/SAX2PrintHandlers.hpp @ 2726

Last change on this file since 2726 was 2726, checked in by cameron, 6 years ago

Add original Xerces tests and samples directories

File size: 4.1 KB
RevLine 
[2726]1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: SAX2PrintHandlers.hpp 557282 2007-07-18 14:54:15Z amassari $
20 */
21
22#include    <xercesc/sax2/DefaultHandler.hpp>
23#include    <xercesc/framework/XMLFormatter.hpp>
24
25XERCES_CPP_NAMESPACE_USE
26
27class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget
28{
29public:
30    // -----------------------------------------------------------------------
31    //  Constructors
32    // -----------------------------------------------------------------------
33    SAX2PrintHandlers
34    (
35        const   char* const                 encodingName
36        , const XMLFormatter::UnRepFlags    unRepFlags
37                , const bool                                            expandNamespaces
38    );
39    ~SAX2PrintHandlers();
40
41
42    // -----------------------------------------------------------------------
43    //  Implementations of the format target interface
44    // -----------------------------------------------------------------------
45    void writeChars
46    (
47        const   XMLByte* const  toWrite
48    );
49
50    virtual void writeChars
51    (
52        const   XMLByte* const  toWrite
53        , const XMLSize_t       count
54        , XMLFormatter* const   formatter
55    );
56
57
58    // -----------------------------------------------------------------------
59    //  Implementations of the SAX DocumentHandler interface
60    // -----------------------------------------------------------------------
61    void endDocument();
62
63    void endElement( const XMLCh* const uri,
64                                         const XMLCh* const localname,
65                                         const XMLCh* const qname);
66
67    void characters(const XMLCh* const chars, const XMLSize_t length);
68
69    void ignorableWhitespace
70    (
71        const   XMLCh* const    chars
72        , const XMLSize_t       length
73    );
74
75    void processingInstruction
76    (
77        const   XMLCh* const    target
78        , const XMLCh* const    data
79    );
80
81    void startDocument();
82
83    void startElement(  const   XMLCh* const    uri,
84                                                const   XMLCh* const    localname,
85                                                const   XMLCh* const    qname,
86                                            const   Attributes&         attributes);
87
88
89
90    // -----------------------------------------------------------------------
91    //  Implementations of the SAX ErrorHandler interface
92    // -----------------------------------------------------------------------
93    void warning(const SAXParseException& exc);
94    void error(const SAXParseException& exc);
95    void fatalError(const SAXParseException& exc);
96
97
98
99    // -----------------------------------------------------------------------
100    //  Implementation of the SAX DTDHandler interface
101    // -----------------------------------------------------------------------
102    void notationDecl
103    (
104        const   XMLCh* const    name
105        , const XMLCh* const    publicId
106        , const XMLCh* const    systemId
107    );
108
109    void unparsedEntityDecl
110    (
111        const   XMLCh* const    name
112        , const XMLCh* const    publicId
113        , const XMLCh* const    systemId
114        , const XMLCh* const    notationName
115    );
116
117private :
118    // -----------------------------------------------------------------------
119    //  Private data members
120    //
121    //  fFormatter
122    //      This is the formatter object that is used to output the data
123    //      to the target. It is set up to format to the standard output
124    //      stream.
125    // -----------------------------------------------------------------------
126    XMLFormatter    fFormatter;
127        bool                    fExpandNS ;
128};
Note: See TracBrowser for help on using the repository browser.