source: icXML/icXML-devel/samples/src/Redirect/RedirectHandlers.hpp @ 2733

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

More path fixes.

File size: 4.1 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: RedirectHandlers.hpp 679377 2008-07-24 11:56:42Z borisk $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include <icxercesc/sax/HandlerBase.hpp>
27#include <xercesc/util/XMLEntityResolver.hpp>
28
29XERCES_CPP_NAMESPACE_USE
30
31XERCES_CPP_NAMESPACE_BEGIN
32class AttributeList;
33XERCES_CPP_NAMESPACE_END
34
35
36class RedirectHandlers : public HandlerBase, public XMLEntityResolver
37{
38public:
39    // -----------------------------------------------------------------------
40    //  Constructors and Destructor
41    // -----------------------------------------------------------------------
42    RedirectHandlers();
43    ~RedirectHandlers();
44
45
46    // -----------------------------------------------------------------------
47    //  Getter methods
48    // -----------------------------------------------------------------------
49    XMLSize_t getElementCount()
50    {
51        return fElementCount;
52    }
53
54    XMLSize_t getAttrCount()
55    {
56        return fAttrCount;
57    }
58
59    XMLSize_t getCharacterCount()
60    {
61        return fCharacterCount;
62    }
63
64    XMLSize_t getSpaceCount()
65    {
66        return fSpaceCount;
67    }
68
69
70    // -----------------------------------------------------------------------
71    //  Handlers for the SAX DocumentHandler interface
72    // -----------------------------------------------------------------------
73    void startElement(const XMLCh* const name, AttributeList& attributes);
74    void characters(const XMLCh* const chars, const XMLSize_t length);
75    void ignorableWhitespace(const XMLCh* const chars, const XMLSize_t length);
76    void resetDocument();
77
78
79    // -----------------------------------------------------------------------
80    //  Handlers for the SAX ErrorHandler interface
81    // -----------------------------------------------------------------------
82    void warning(const SAXParseException& exc);
83    void error(const SAXParseException& exc);
84    void fatalError(const SAXParseException& exc);
85
86
87    // This is the SAX2 resolveEntity interface.  This is inherited from
88    // EntityResolver.
89    // -----------------------------------------------------------------------
90    //  Handlers for the SAX EntityResolver interface
91    // -----------------------------------------------------------------------
92    InputSource* resolveEntity
93    (
94        const   XMLCh* const    publicId
95        , const XMLCh* const    systemId
96    );
97
98    // -----------------------------------------------------------------------
99    //  Handlers for the XMLEntityResolver interface
100    // -----------------------------------------------------------------------
101    InputSource* resolveEntity
102    (
103        XMLResourceIdentifier* resourceIdentifier
104    );
105
106private:
107    // -----------------------------------------------------------------------
108    //  Private data members
109    //
110    //  fAttrCount
111    //  fCharacterCount
112    //  fElementCount
113    //  fSpaceCount
114    //      These are just counters that are run upwards based on the input
115    //      from the document handlers.
116    // -----------------------------------------------------------------------
117    XMLSize_t       fAttrCount;
118    XMLSize_t       fCharacterCount;
119    XMLSize_t       fElementCount;
120    XMLSize_t       fSpaceCount;
121};
Note: See TracBrowser for help on using the repository browser.