]> matita.cs.unibo.it Git - helm.git/blob - helm/papers/use_case/stats/parse/SAX2Print/SAX2PrintHandlers.hpp
ocaml 3.09 transition
[helm.git] / helm / papers / use_case / stats / parse / SAX2Print / SAX2PrintHandlers.hpp
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$
19  * Revision 1.1  2004/11/23 13:38:52  lpadovan
20  * * basic infrastructure for collecting statistics
21  *
22  * Revision 1.7  2004/09/08 13:55:33  peiyongz
23  * Apache License Version 2.0
24  *
25  * Revision 1.6  2004/02/15 19:43:15  amassari
26  * Removed cause for warnings in VC 7.1
27  *
28  * Revision 1.5  2002/11/05 21:46:20  tng
29  * Explicit code using namespace in application.
30  *
31  * Revision 1.4  2002/02/01 22:40:44  peiyongz
32  * sane_include
33  *
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.
37  *
38  * Revision 1.2  2000/08/09 22:20:39  jpolast
39  * updates for changes to sax2 core functionality.
40  *
41  * Revision 1.1  2000/08/02 19:16:14  jpolast
42  * initial checkin of SAX2Print
43  *
44  *
45  */
46
47 #include    <xercesc/sax2/DefaultHandler.hpp>
48 #include    <xercesc/framework/XMLFormatter.hpp>
49
50 XERCES_CPP_NAMESPACE_USE
51
52 class SAX2PrintHandlers : public DefaultHandler, private XMLFormatTarget
53 {
54 public:
55     // -----------------------------------------------------------------------
56     //  Constructors
57     // -----------------------------------------------------------------------
58     SAX2PrintHandlers
59     (
60         const   char* const                 encodingName
61         , const XMLFormatter::UnRepFlags    unRepFlags
62                 , const bool                                            expandNamespaces
63     );
64     ~SAX2PrintHandlers();
65
66
67     // -----------------------------------------------------------------------
68     //  Implementations of the format target interface
69     // -----------------------------------------------------------------------
70     void writeChars
71     (
72         const   XMLByte* const  toWrite
73     );
74
75     void writeChars
76     (
77         const   XMLByte* const  toWrite
78         , const unsigned int    count
79         , XMLFormatter* const   formatter
80     );
81
82
83     // -----------------------------------------------------------------------
84     //  Implementations of the SAX DocumentHandler interface
85     // -----------------------------------------------------------------------
86     void endDocument();
87
88     void endElement( const XMLCh* const uri,
89                                          const XMLCh* const localname,
90                                          const XMLCh* const qname);
91
92     void characters(const XMLCh* const chars, const unsigned int length);
93
94     void ignorableWhitespace
95     (
96         const   XMLCh* const    chars
97         , const unsigned int    length
98     );
99
100     void processingInstruction
101     (
102         const   XMLCh* const    target
103         , const XMLCh* const    data
104     );
105
106     void startDocument();
107
108     void startElement(  const   XMLCh* const    uri,
109                                                 const   XMLCh* const    localname,
110                                                 const   XMLCh* const    qname,
111                                             const   Attributes&         attributes);
112
113
114
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);
121
122
123
124     // -----------------------------------------------------------------------
125     //  Implementation of the SAX DTDHandler interface
126     // -----------------------------------------------------------------------
127     void notationDecl
128     (
129         const   XMLCh* const    name
130         , const XMLCh* const    publicId
131         , const XMLCh* const    systemId
132     );
133
134     void unparsedEntityDecl
135     (
136         const   XMLCh* const    name
137         , const XMLCh* const    publicId
138         , const XMLCh* const    systemId
139         , const XMLCh* const    notationName
140     );
141
142 private :
143     // -----------------------------------------------------------------------
144     //  Private data members
145     //
146     //  fFormatter
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
149     //      stream.
150     // -----------------------------------------------------------------------
151     XMLFormatter    fFormatter;
152         bool                    fExpandNS ;
153 };