source: icXML/icXML-devel/samples/src/PParse/PParseHandlers.hpp @ 2733

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

More path fixes.

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