Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

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

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo