source: NonGTP/Xerces/xerces/samples/MemParse/MemParseHandlers.hpp @ 358

Revision 358, 4.0 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: MemParseHandlers.hpp,v $
19 * Revision 1.7  2004/09/08 13:55:32  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.6  2002/11/05 21:46:19  tng
23 * Explicit code using namespace in application.
24 *
25 * Revision 1.5  2002/11/04 15:23:03  tng
26 * C++ Namespace Support.
27 *
28 * Revision 1.4  2002/02/01 22:37:14  peiyongz
29 * sane_include
30 *
31 * Revision 1.3  2000/03/02 19:53:42  roddey
32 * This checkin includes many changes done while waiting for the
33 * 1.1.0 code to be finished. I can't list them all here, but a list is
34 * available elsewhere.
35 *
36 * Revision 1.2  2000/02/06 07:47:19  rahulj
37 * Year 2K copyright swat.
38 *
39 * Revision 1.1.1.1  1999/11/09 01:09:50  twl
40 * Initial checkin
41 *
42 * Revision 1.6  1999/11/08 20:43:37  rahul
43 * Swat for adding in Product name and CVS comment log variable.
44 *
45 */
46
47
48// ---------------------------------------------------------------------------
49//  Includes
50// ---------------------------------------------------------------------------
51#include <xercesc/sax/HandlerBase.hpp>
52
53XERCES_CPP_NAMESPACE_USE
54
55XERCES_CPP_NAMESPACE_BEGIN
56class AttributeList;
57XERCES_CPP_NAMESPACE_END
58
59
60class MemParseHandlers : public HandlerBase
61{
62public:
63    // -----------------------------------------------------------------------
64    //  Constructors and Destructor
65    // -----------------------------------------------------------------------
66    MemParseHandlers();
67    ~MemParseHandlers();
68
69
70    // -----------------------------------------------------------------------
71    //  Getter methods
72    // -----------------------------------------------------------------------
73    unsigned int getElementCount()
74    {
75        return fElementCount;
76    }
77
78    unsigned int getAttrCount()
79    {
80        return fAttrCount;
81    }
82
83    unsigned int getCharacterCount()
84    {
85        return fCharacterCount;
86    }
87
88    unsigned int getSpaceCount()
89    {
90        return fSpaceCount;
91    }
92
93
94    // -----------------------------------------------------------------------
95    //  Handlers for the SAX DocumentHandler interface
96    // -----------------------------------------------------------------------
97    void startElement(const XMLCh* const name, AttributeList& attributes);
98    void characters(const XMLCh* const chars, const unsigned int length);
99    void ignorableWhitespace(const XMLCh* const chars, const unsigned int length);
100    void resetDocument();
101
102
103    // -----------------------------------------------------------------------
104    //  Handlers for the SAX ErrorHandler interface
105    // -----------------------------------------------------------------------
106    void warning(const SAXParseException& exception);
107    void error(const SAXParseException& exception);
108    void fatalError(const SAXParseException& exception);
109
110
111
112private:
113    // -----------------------------------------------------------------------
114    //  Private data members
115    //
116    //  fAttrCount
117    //  fCharacterCount
118    //  fElementCount
119    //  fSpaceCount
120    //      These are just counters that are run upwards based on the input
121    //      from the document handlers.
122    // -----------------------------------------------------------------------
123    unsigned int    fAttrCount;
124    unsigned int    fCharacterCount;
125    unsigned int    fElementCount;
126    unsigned int    fSpaceCount;
127};
Note: See TracBrowser for help on using the repository browser.