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: MemParseHandlers.hpp 679377 2008-07-24 11:56:42Z borisk $ |
---|
20 | */ |
---|
21 | |
---|
22 | |
---|
23 | // --------------------------------------------------------------------------- |
---|
24 | // Includes |
---|
25 | // --------------------------------------------------------------------------- |
---|
26 | #include <icxercesc/sax/HandlerBase.hpp> |
---|
27 | |
---|
28 | XERCES_CPP_NAMESPACE_USE |
---|
29 | |
---|
30 | XERCES_CPP_NAMESPACE_BEGIN |
---|
31 | class AttributeList; |
---|
32 | XERCES_CPP_NAMESPACE_END |
---|
33 | |
---|
34 | |
---|
35 | class MemParseHandlers : public HandlerBase |
---|
36 | { |
---|
37 | public: |
---|
38 | // ----------------------------------------------------------------------- |
---|
39 | // Constructors and Destructor |
---|
40 | // ----------------------------------------------------------------------- |
---|
41 | MemParseHandlers(); |
---|
42 | ~MemParseHandlers(); |
---|
43 | |
---|
44 | |
---|
45 | // ----------------------------------------------------------------------- |
---|
46 | // Getter methods |
---|
47 | // ----------------------------------------------------------------------- |
---|
48 | XMLSize_t getElementCount() |
---|
49 | { |
---|
50 | return fElementCount; |
---|
51 | } |
---|
52 | |
---|
53 | XMLSize_t getAttrCount() |
---|
54 | { |
---|
55 | return fAttrCount; |
---|
56 | } |
---|
57 | |
---|
58 | XMLSize_t getCharacterCount() |
---|
59 | { |
---|
60 | return fCharacterCount; |
---|
61 | } |
---|
62 | |
---|
63 | XMLSize_t getSpaceCount() |
---|
64 | { |
---|
65 | return fSpaceCount; |
---|
66 | } |
---|
67 | |
---|
68 | |
---|
69 | // ----------------------------------------------------------------------- |
---|
70 | // Handlers for the SAX DocumentHandler interface |
---|
71 | // ----------------------------------------------------------------------- |
---|
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 | |
---|
86 | |
---|
87 | private: |
---|
88 | // ----------------------------------------------------------------------- |
---|
89 | // Private data members |
---|
90 | // |
---|
91 | // fAttrCount |
---|
92 | // fCharacterCount |
---|
93 | // fElementCount |
---|
94 | // fSpaceCount |
---|
95 | // These are just counters that are run upwards based on the input |
---|
96 | // from the document handlers. |
---|
97 | // ----------------------------------------------------------------------- |
---|
98 | XMLSize_t fAttrCount; |
---|
99 | XMLSize_t fCharacterCount; |
---|
100 | XMLSize_t fElementCount; |
---|
101 | XMLSize_t fSpaceCount; |
---|
102 | }; |
---|