source: icXML/icXML-devel/samples/src/StdInParse/StdInParseHandlers.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: 3.3 KB
Line 
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: StdInParseHandlers.hpp 679377 2008-07-24 11:56:42Z borisk $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include <xercesc/sax/HandlerBase.hpp>
27
28XERCES_CPP_NAMESPACE_USE
29
30XERCES_CPP_NAMESPACE_BEGIN
31class AttributeList;
32XERCES_CPP_NAMESPACE_END
33
34class StdInParseHandlers : public HandlerBase
35{
36public:
37    // -----------------------------------------------------------------------
38    //  Constructors and Destructor
39    // -----------------------------------------------------------------------
40    StdInParseHandlers();
41    ~StdInParseHandlers();
42
43
44    // -----------------------------------------------------------------------
45    //  Getter methods
46    // -----------------------------------------------------------------------
47    XMLSize_t getElementCount()
48    {
49        return fElementCount;
50    }
51
52    XMLSize_t getAttrCount()
53    {
54        return fAttrCount;
55    }
56
57    XMLSize_t getCharacterCount()
58    {
59        return fCharacterCount;
60    }
61
62    XMLSize_t getSpaceCount()
63    {
64        return fSpaceCount;
65    }
66
67
68    // -----------------------------------------------------------------------
69    //  Handlers for the SAX DocumentHandler interface
70    // -----------------------------------------------------------------------
71    void endElement(const XMLCh* const name);
72        void startElement(const XMLCh* const name, AttributeList& attributes);
73    void characters(const XMLCh* const chars, const XMLSize_t length);
74    void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length);
75    void resetDocument();
76
77
78    // -----------------------------------------------------------------------
79    //  Handlers for the SAX ErrorHandler interface
80    // -----------------------------------------------------------------------
81        void warning(const SAXParseException& exc);
82    void error(const SAXParseException& exc);
83    void fatalError(const SAXParseException& exc);
84
85
86private:
87    // -----------------------------------------------------------------------
88    //  Private data members
89    //
90    //  fAttrCount
91    //  fCharacterCount
92    //  fElementCount
93    //  fSpaceCount
94    //      These are just counters that are run upwards based on the input
95    //      from the document handlers.
96    // -----------------------------------------------------------------------
97    XMLSize_t       fAttrCount;
98    XMLSize_t       fCharacterCount;
99    XMLSize_t       fElementCount;
100    XMLSize_t       fSpaceCount;
101};
Note: See TracBrowser for help on using the repository browser.