source: icXML/icXML-devel/tests/src/XSerializerTest/XSerializerHandlers.hpp @ 2733

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

More path fixes.

File size: 3.7 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: XSerializerHandlers.hpp 676796 2008-07-15 05:04:13Z dbertoni $
20 */
21
22#if !defined(XSERIALIZER_HANDLER_HPP)
23#define XSERIALIZER_HANDLER_HPP
24
25// ---------------------------------------------------------------------------
26//  Includes
27// ---------------------------------------------------------------------------
28#include <xercesc/sax2/Attributes.hpp>
29#include <icxercesc/sax2/DefaultHandler.hpp>
30
31XERCES_CPP_NAMESPACE_USE
32
33class XSerializerHandlers : public DefaultHandler
34{
35public:
36    // -----------------------------------------------------------------------
37    //  Constructors and Destructor
38    // -----------------------------------------------------------------------
39    XSerializerHandlers();
40    ~XSerializerHandlers();
41
42
43    // -----------------------------------------------------------------------
44    //  Getter methods
45    // -----------------------------------------------------------------------
46    XMLSize_t getElementCount() const
47    {
48        return fElementCount;
49    }
50
51    XMLSize_t getAttrCount() const
52    {
53        return fAttrCount;
54    }
55
56    XMLSize_t getCharacterCount() const
57    {
58        return fCharacterCount;
59    }
60
61    bool getSawErrors() const
62    {
63        return fSawErrors;
64    }
65
66    XMLSize_t getSpaceCount() const
67    {
68        return fSpaceCount;
69    }
70
71
72    // -----------------------------------------------------------------------
73    //  Handlers for the SAX ContentHandler interface
74    // -----------------------------------------------------------------------
75    void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs);
76    void characters(const XMLCh* const chars, const XMLSize_t length);
77    void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length);
78    void resetDocument();
79
80
81    // -----------------------------------------------------------------------
82    //  Handlers for the SAX ErrorHandler interface
83    // -----------------------------------------------------------------------
84        void warning(const SAXParseException& exc);
85    void error(const SAXParseException& exc);
86    void fatalError(const SAXParseException& exc);
87    void resetErrors();
88
89
90private:
91    // -----------------------------------------------------------------------
92    //  Private data members
93    //
94    //  fAttrCount
95    //  fCharacterCount
96    //  fElementCount
97    //  fSpaceCount
98    //      These are just counters that are run upwards based on the input
99    //      from the document handlers.
100    //
101    //  fSawErrors
102    //      This is set by the error handlers, and is queryable later to
103    //      see if any errors occured.
104    // -----------------------------------------------------------------------
105    XMLSize_t       fAttrCount;
106    XMLSize_t       fCharacterCount;
107    XMLSize_t       fElementCount;
108    XMLSize_t       fSpaceCount;
109    bool            fSawErrors;
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.