Xalan-C++ API Reference 1.12.0
XalanSourceTreeContentHandler.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#if !defined(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
20#define XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680
21
22
23
25
26
27
29
30
31
32#include <xercesc/sax/DocumentHandler.hpp>
33#include <xercesc/sax/DTDHandler.hpp>
34#include <xercesc/sax2/ContentHandler.hpp>
35#include <xercesc/sax2/LexicalHandler.hpp>
36
37
38
40
41
42
43namespace XERCES_CPP_NAMESPACE
44{
45 class Attributes;
46 class AttributeList;
47 class ContentHandler;
48 class DTDHandler;
49 class LexicalHandler;
50 class Locator;
51}
52
53
54
55namespace XALAN_CPP_NAMESPACE {
56
57
58
59using xercesc::Locator;
60
61
62
63typedef xercesc::Attributes AttributesType;
64typedef xercesc::AttributeList AttributeListType;
65typedef xercesc::ContentHandler ContentHandlerType;
66typedef xercesc::DTDHandler DTDHandlerType;
67typedef xercesc::LexicalHandler LexicalHandlerType;
68typedef xercesc::Locator LocatorType;
69
70
71
72class XalanNode;
75
76
77
79 public ContentHandlerType,
80 public DTDHandlerType,
82{
83public:
84
88
89 enum { eDefaultStackSize = 50, eDefaultTextBufferSize = 100 };
90
91
92 // Constructor
93 explicit
95 MemoryManager& theManager,
97 bool fAccumulateText = true);
98
99 virtual
101
102
103 // Inherited from ContentHandler...
104 virtual void
106 const XMLCh* const chars,
107 const size_type length);
108
109 virtual void
111
112 virtual void
114 const XMLCh* const uri,
115 const XMLCh* const localname,
116 const XMLCh* const qname);
117
118 virtual void
120 const XMLCh* const chars,
121 const size_type length);
122
123 virtual void
125 const XMLCh* const target,
126 const XMLCh* const data);
127
128 virtual void
129 setDocumentLocator(const Locator* const locator);
130
131 virtual void
133
134 virtual void
136 const XMLCh* const uri,
137 const XMLCh* const localname,
138 const XMLCh* const qname,
139 const AttributesType& attrs);
140
141 virtual void
143 const XMLCh* const prefix,
144 const XMLCh* const uri);
145
146 virtual void
148
149
150 virtual void
151 skippedEntity(const XMLCh* const name);
152
153
154 // Inherited from DTDHandler...
155
156 virtual void
158 const XMLCh* const name,
159 const XMLCh* const publicId,
160 const XMLCh* const systemId);
161
162 virtual void
164 const XMLCh* const name,
165 const XMLCh* const publicId,
166 const XMLCh* const systemId,
167 const XMLCh* const notationName);
168
169 virtual void
171
172
173 // Inherited from LexicalHandler...
174
175 virtual void
177 const XMLCh* const chars,
178 const size_type length);
179
180 virtual void
182
183 virtual void
185
186 virtual void
187 endEntity(const XMLCh* const name);
188
189 virtual void
191
192 virtual void
194 const XMLCh* const name,
195 const XMLCh* const publicId,
196 const XMLCh* const systemId);
197
198 virtual void
199 startEntity(const XMLCh* const name);
200
201
202 // New to XalanSourceTreeContentHandler...
203
206 {
207 return m_document;
208 }
209
210 void
212
213private:
214
215 // Not implemented...
217
219 operator=(const XalanSourceTreeContentHandler&);
220
221 bool
223
224 // Helper functions...
226 createElement(
227 const XMLCh* const uri,
228 const XMLCh* const localname,
229 const XMLCh* const qname,
230 const AttributesType& attrs,
232
233 void
234 processAccumulatedText();
235
236 void
237 doCharacters(
238 const XMLCh* chars,
239 size_type length);
240
241 // Data members...
242
243 // The current document we're building...
244 XalanSourceTreeDocument* m_document;
245
246 // The current element...
247 XalanSourceTreeElement* m_currentElement;
248
249 // Stack of elements...
250 ElementStackType m_elementStack;
251
252 // The last child appended to the current element. This is
253 // an important optimization, because XalanSourceTreeElement
254 // does not have a pointer to its last child. Without this,
255 // appending a child becomes a linear search.
256 XalanNode* m_lastChild;
257
258 // Stack of last children appended. There is a ono-to-one
259 // correspondance to the entries in m_elementStack.
260 LastChildStackType m_lastChildStack;
261
262 // If true, the handler will accumulate text from calls to
263 // characters() until another event triggers the creation
264 // of the node.
265 const bool m_accumulateText;
266
267 // A buffer to hold accumulated text.
268 XalanDOMString m_textBuffer;
269
270 // A flag to determine if the DTD is being processed.
271 bool m_inDTD;
272};
273
274
275
276}
277
278
279
280#endif // #if !defined(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
#define XALAN_XALANSOURCETREE_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual void setDocumentLocator(const Locator *const locator)
virtual void startPrefixMapping(const XMLCh *const prefix, const XMLCh *const uri)
virtual void characters(const XMLCh *const chars, const size_type length)
virtual void startEntity(const XMLCh *const name)
void setDocument(XalanSourceTreeDocument *theDocument)
virtual void startDTD(const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)
virtual void comment(const XMLCh *const chars, const size_type length)
virtual void unparsedEntityDecl(const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const notationName)
virtual void processingInstruction(const XMLCh *const target, const XMLCh *const data)
XalanSourceTreeContentHandler(MemoryManager &theManager, XalanSourceTreeDocument *theDocument=0, bool fAccumulateText=true)
virtual void endEntity(const XMLCh *const name)
virtual void endPrefixMapping(const XMLCh *const prefix)
XalanVector< XalanSourceTreeElement * > ElementStackType
virtual void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
virtual void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const AttributesType &attrs)
virtual void notationDecl(const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)
virtual void ignorableWhitespace(const XMLCh *const chars, const size_type length)
virtual void skippedEntity(const XMLCh *const name)
xercesc::Attributes AttributesType
xercesc::Locator LocatorType
xercesc::AttributeList AttributeListType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
xercesc::DTDHandler DTDHandlerType
xercesc::LexicalHandler LexicalHandlerType
xercesc::ContentHandler ContentHandlerType