Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


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 
43 XALAN_DECLARE_XERCES_CLASS(Attributes)
44 XALAN_DECLARE_XERCES_CLASS(AttributeList)
45 XALAN_DECLARE_XERCES_CLASS(ContentHandler)
46 XALAN_DECLARE_XERCES_CLASS(DTDHandler)
47 XALAN_DECLARE_XERCES_CLASS(LexicalHandler)
48 XALAN_DECLARE_XERCES_CLASS(Locator)
49 
50 
51 
52 XALAN_CPP_NAMESPACE_BEGIN
53 
54 
55 
56 XALAN_USING_XERCES(Locator)
57 
58 
59 
60 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType;
61 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType;
62 typedef XERCES_CPP_NAMESPACE_QUALIFIER ContentHandler ContentHandlerType;
63 typedef XERCES_CPP_NAMESPACE_QUALIFIER DTDHandler DTDHandlerType;
64 typedef XERCES_CPP_NAMESPACE_QUALIFIER LexicalHandler LexicalHandlerType;
65 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType;
66 
67 
68 
69 class XalanNode;
72 
73 
74 
76  public ContentHandlerType,
77  public DTDHandlerType,
78  public LexicalHandlerType
79 {
80 public:
81 
84  typedef XalanSize_t size_type;
85 
86  enum { eDefaultStackSize = 50, eDefaultTextBufferSize = 100 };
87 
88 
89  // Constructor
90  explicit
92  MemoryManager& theManager,
93  XalanSourceTreeDocument* theDocument = 0,
94  bool fAccumulateText = true);
95 
96  virtual
98 
99 
100  // Inherited from ContentHandler...
101  virtual void
102  characters(
103  const XMLCh* const chars,
104  const size_type length);
105 
106  virtual void
107  endDocument();
108 
109  virtual void
110  endElement(
111  const XMLCh* const uri,
112  const XMLCh* const localname,
113  const XMLCh* const qname);
114 
115  virtual void
116  ignorableWhitespace(
117  const XMLCh* const chars,
118  const size_type length);
119 
120  virtual void
121  processingInstruction(
122  const XMLCh* const target,
123  const XMLCh* const data);
124 
125  virtual void
126  setDocumentLocator(const Locator* const locator);
127 
128  virtual void
129  startDocument();
130 
131  virtual void
132  startElement(
133  const XMLCh* const uri,
134  const XMLCh* const localname,
135  const XMLCh* const qname,
136  const AttributesType& attrs);
137 
138  virtual void
139  startPrefixMapping(
140  const XMLCh* const prefix,
141  const XMLCh* const uri);
142 
143  virtual void
144  endPrefixMapping(const XMLCh* const prefix);
145 
146 
147  virtual void
148  skippedEntity(const XMLCh* const name);
149 
150 
151  // Inherited from DTDHandler...
152 
153  virtual void
154  notationDecl(
155  const XMLCh* const name,
156  const XMLCh* const publicId,
157  const XMLCh* const systemId);
158 
159  virtual void
160  unparsedEntityDecl(
161  const XMLCh* const name,
162  const XMLCh* const publicId,
163  const XMLCh* const systemId,
164  const XMLCh* const notationName);
165 
166  virtual void
167  resetDocType();
168 
169 
170  // Inherited from LexicalHandler...
171 
172  virtual void
173  comment(
174  const XMLCh* const chars,
175  const size_type length);
176 
177  virtual void
178  endCDATA();
179 
180  virtual void
181  endDTD();
182 
183  virtual void
184  endEntity(const XMLCh* const name);
185 
186  virtual void
187  startCDATA();
188 
189  virtual void
190  startDTD(
191  const XMLCh* const name,
192  const XMLCh* const publicId,
193  const XMLCh* const systemId);
194 
195  virtual void
196  startEntity(const XMLCh* const name);
197 
198 
199  // New to XalanSourceTreeContentHandler...
200 
201  XalanSourceTreeDocument*
202  getDocument() const
203  {
204  return m_document;
205  }
206 
207  void
208  setDocument(XalanSourceTreeDocument* theDocument);
209 
210 private:
211 
212  // Not implemented...
214 
216  operator=(const XalanSourceTreeContentHandler&);
217 
218  bool
220 
221  // Helper functions...
222  XalanSourceTreeElement*
223  createElement(
224  const XMLCh* const uri,
225  const XMLCh* const localname,
226  const XMLCh* const qname,
227  const AttributesType& attrs,
228  XalanSourceTreeElement* theOwnerElement);
229 
230  void
231  processAccumulatedText();
232 
233  void
234  doCharacters(
235  const XMLCh* chars,
236  size_type length);
237 
238  // Data members...
239 
240  // The current document we're building...
241  XalanSourceTreeDocument* m_document;
242 
243  // The current element...
244  XalanSourceTreeElement* m_currentElement;
245 
246  // Stack of elements...
247  ElementStackType m_elementStack;
248 
249  // The last child appended to the current element. This is
250  // an important optimization, because XalanSourceTreeElement
251  // does not have a pointer to its last child. Without this,
252  // appending a child becomes a linear search.
253  XalanNode* m_lastChild;
254 
255  // Stack of last children appended. There is a ono-to-one
256  // correspondance to the entries in m_elementStack.
257  LastChildStackType m_lastChildStack;
258 
259  // If true, the handler will accumulate text from calls to
260  // characters() until another event triggers the creation
261  // of the node.
262  const bool m_accumulateText;
263 
264  // A buffer to hold accumulated text.
265  XalanDOMString m_textBuffer;
266 
267  // A flag to determine if the DTD is being processed.
268  bool m_inDTD;
269 };
270 
271 
272 
273 XALAN_CPP_NAMESPACE_END
274 
275 
276 
277 #endif // #if !defined(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType
XalanVector< XalanSourceTreeElement * > ElementStackType
XERCES_CPP_NAMESPACE_QUALIFIER LexicalHandler LexicalHandlerType
XERCES_CPP_NAMESPACE_QUALIFIER DTDHandler DTDHandlerType
XalanVector< XalanNode * > LastChildStackType
XalanSourceTreeDocument * getDocument() const
#define XALAN_XALANSOURCETREE_EXPORT
XERCES_CPP_NAMESPACE_QUALIFIER ContentHandler ContentHandlerType
bool operator==(const ElemAttributeSet &theLHS, const ElemAttributeSet &theRHS)
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType
XALAN_CPP_NAMESPACE_BEGIN XALAN_USING_XERCES(Locator)
XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType

Interpreting class diagrams

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

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

Apache Logo