Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XalanSourceTreeDocument.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 #if !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
19 #define XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
29 
30 
31 
34 
35 
36 
40 
41 
42 
53 
54 
55 
56 XALAN_DECLARE_XERCES_CLASS(Attributes)
57 XALAN_DECLARE_XERCES_CLASS(AttributeList)
58 
59 
60 
61 XALAN_CPP_NAMESPACE_BEGIN
62 
63 
64 
65 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType;
66 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType;
67 
68 
69 
70 class PrefixResolver;
72 
73 
74 
76 {
77 public:
78 
80 
81  typedef XalanMap<
82  const XalanDOMChar*,
84 
85  typedef XalanMap<
87  XalanDOMString> UnparsedEntityURIMapType;
88 
89 
90  /**
91  * Perform static initialization. See class XalanSourceTreeInit.
92  */
93  static void
94  initialize(MemoryManager& theManager);
95 
96  /**
97  * Perform static shut down. See class XalanSourceTreeInit.
98  */
99  static void
100  terminate();
101 
102 
103  enum { eDefaultAttributeAllocatorBlockSize = 100,
104  eDefaultAttributeNSAllocatorBlockSize = 50,
105  eDefaultCommentAllocatorBlockSize = 10,
106  eDefaultElementAllocatorBlockSize = 100,
107  eDefaultElementNSAllocatorBlockSize = 100,
108  eDefaultPIAllocatorBlockSize = 10,
109  eDefaultTextAllocatorBlockSize = 100,
110  eDefaultTextIWSAllocatorBlockSize = 100,
111  eDefaultNamesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
112  eDefaultNamesStringPoolBucketCount = XalanDOMStringPool::eDefaultBucketCount,
113  eDefaultNamesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize,
114  eDefaultValuesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
115  eDefaultValuesStringPoolBucketCount = 997,
116  eDefaultValuesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize };
117 
118 
123 
124  /**
125  *
126  * Constructor for XalanSourceTreeDocument.
127  *
128  * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
129  * @param theNamesStringPoolBlockSize The block size for allocating strings in the name pool
130  * @param theNamesStringPoolBucketCount The number of buckets for allocating strings in the name pool
131  * @param theNamesStringPoolBucketSize The bucket size for allocating strings in the name pool
132  * @param theValuesStringPoolBlockSize The block size for allocating strings in the values pool
133  * @param theValuesStringPoolBucketCount The number of buckets for allocating strings in the values pool
134  * @param theValuesStringPoolBucketSize The bucket size for allocating strings in the values pool
135  *
136  */
138  MemoryManager& theManager,
139  bool fPoolAllText = s_poolAllTextNodes,
140  block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize,
141  bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount,
142  bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize,
143  block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
144  bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
145  bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
146 
147 
149  create(
150  MemoryManager& theManager,
151  bool fPoolAllText = s_poolAllTextNodes,
152  block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize,
153  bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount,
154  bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize,
155  block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
156  bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
157  bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
158 
159  /**
160  *
161  * Constructor for XalanSourceTreeDocument.
162  *
163  * @param theAttributeBlockSize The block size for allocating attribute nodes
164  * @param theAttributeNSBlockSize The block size for allocating attribute NS nodes
165  * @param theCommentBlockSize The block size for allocating comment nodes
166  * @param theElementBlockSize The block size for allocating element nodes
167  * @param theElementNSBlockSize The block size for allocating element nodes
168  * @param theTextBlockSize The block size for allocating text nodes,
169  * @param theTextIWSBlockSize The block size for allocating text IWS nodes,
170  * @param fPoolAllText If false, text node data that is not whitespace will not be pooled.
171  *
172  */
174  MemoryManager& theManager,
175  allocator_size_type theAttributeBlockSize,
176  allocator_size_type theAttributeNSBlockSize,
177  allocator_size_type theCommentBlockSize,
178  allocator_size_type theElementBlockSize,
179  allocator_size_type theElementNSBlockSize,
180  allocator_size_type thePIBlockSize,
181  allocator_size_type theTextBlockSize,
182  allocator_size_type theTextIWSBlockSize,
183  bool fPoolAllText = s_poolAllTextNodes);
184 
185  virtual
187 
188  // These interfaces are inherited from XalanNode...
189  virtual const XalanDOMString&
190  getNodeName() const;
191 
192  virtual const XalanDOMString&
193  getNodeValue() const;
194 
195  virtual NodeType
196  getNodeType() const;
197 
198  virtual XalanNode*
199  getParentNode() const;
200 
201  virtual const XalanNodeList*
202  getChildNodes() const;
203 
204  virtual XalanNode*
205  getFirstChild() const;
206 
207  virtual XalanNode*
208  getLastChild() const;
209 
210  virtual XalanNode*
211  getPreviousSibling() const;
212 
213  virtual XalanNode*
214  getNextSibling() const;
215 
216  virtual const XalanNamedNodeMap*
217  getAttributes() const;
218 
219  virtual XalanDocument*
220  getOwnerDocument() const;
221 
222  virtual const XalanDOMString&
223  getNamespaceURI() const;
224 
225  virtual const XalanDOMString&
226  getPrefix() const;
227 
228  virtual const XalanDOMString&
229  getLocalName() const;
230 
231  virtual bool
232  isIndexed() const;
233 
234  virtual IndexType
235  getIndex() const;
236 
237  virtual XalanElement*
238  getDocumentElement() const;
239 
240  virtual XalanElement*
241  getElementById(const XalanDOMString& elementId) const;
242 
243 
244  // Interfaces not inherited from XalanDocument...
245 
246  static bool
248  {
249  return s_poolAllTextNodes;
250  }
251 
252  static void
254  {
255  s_poolAllTextNodes = fPool;
256  }
257 
258 
260  createElementNode(
261  const XalanDOMChar* name,
262  const AttributeListType& attrs,
263  XalanNode* theParentNode = 0,
264  XalanNode* thePreviousSibling = 0,
265  XalanNode* theNextSibling = 0,
266  bool fAddXMLNamespaceAttribute = false);
267 
269  createElementNode(
270  const XalanDOMChar* uri,
271  const XalanDOMChar* localname,
272  const XalanDOMChar* qname,
273  const AttributesType& attrs,
274  XalanNode* theParentNode = 0,
275  XalanNode* thePreviousSibling = 0,
276  XalanNode* theNextSibling = 0,
277  bool fAddXMLNamespaceAttribute = false);
278 
280  createElementNode(
281  const XalanDOMChar* tagName,
282  const AttributeListType& attrs,
283  const PrefixResolver& thePrefixResolver,
284  XalanNode* theParentNode = 0,
285  XalanNode* thePreviousSibling = 0,
286  XalanNode* theNextSibling = 0,
287  bool fAddXMLNamespaceAttribute = false);
288 
290  createElementNode(
291  const XalanDOMChar* name,
292  const AttributesType& attrs,
293  XalanNode* theParentNode = 0,
294  XalanNode* thePreviousSibling = 0,
295  XalanNode* theNextSibling = 0,
296  bool fAddXMLNamespaceAttribute = false);
297 
299  createCommentNode(
300  const XalanDOMChar* data,
302  XalanNode* theParentNode = 0,
303  XalanNode* thePreviousSibling = 0,
304  XalanNode* theNextSibling = 0);
305 
307  createProcessingInstructionNode(
308  const XalanDOMChar* target,
309  const XalanDOMChar* data,
310  XalanNode* theParentNode = 0,
311  XalanNode* thePreviousSibling = 0,
312  XalanNode* theNextSibling = 0);
313 
315  createTextNode(
316  const XalanDOMChar* chars,
318  XalanNode* theParentNode = 0,
319  XalanNode* thePreviousSibling = 0,
320  XalanNode* theNextSibling = 0);
321 
323  createTextIWSNode(
324  const XalanDOMChar* chars,
326  XalanNode* theParentNode = 0,
327  XalanNode* thePreviousSibling = 0,
328  XalanNode* theNextSibling = 0);
329 
330  void
331  unparsedEntityDeclaration(
332  const XalanDOMChar* name,
333  const XalanDOMChar* publicId,
334  const XalanDOMChar* systemId,
335  const XalanDOMChar* notationName);
336 
337  const XalanDOMString&
338  getUnparsedEntityURI(const XalanDOMString& theName) const;
339 
340  // Child node setters...
341  void
342  appendChildNode(XalanSourceTreeComment* theChild);
343 
344  void
345  appendChildNode(XalanSourceTreeElement* theChild);
346 
347  void
348  appendChildNode(XalanSourceTreeProcessingInstruction* theChild);
349 
350 private:
351 
352  MemoryManager&
353  getMemoryManager()
354  {
355  return m_stringBuffer.getMemoryManager();
356  }
357 
358  // Helper functions...
360  createAttribute(
361  const XalanDOMChar* theName,
362  const XalanDOMChar* theValue,
363  XalanSourceTreeElement* theOwnerElement,
364  const PrefixResolver& thePrefixResolver);
365 
367  createAttribute(
368  const XalanDOMChar* theName,
369  const XalanDOMChar* theValue,
370  XalanSourceTreeElement* theOwnerElement);
371 
372  size_t
373  createAttributes(
374  XalanSourceTreeAttr** theAttributeVector,
375  const AttributeListType& attrs,
376  size_t theStartIndex,
377  XalanSourceTreeElement* theOwnerElement,
378  bool fCreateNamespaces,
379  const PrefixResolver* thePrefixResolver = 0);
380 
382  createElementNode(
383  const XalanDOMChar* theTagName,
384  XalanSourceTreeAttr** theAttributeVector,
385  XalanSize_t theAttributeCount,
386  XalanNode* theParentNode,
387  XalanNode* thePreviousSibling,
388  XalanNode* theNextSibling,
389  const PrefixResolver& thePrefixResolver);
390 
391  size_t
392  createAttributes(
393  XalanSourceTreeAttr** theAttributeVector,
394  const AttributesType& theAttributes,
395  size_t theStartIndex,
396  XalanSourceTreeElement* theOwnerElement,
397  bool fCreateNamespaces);
398 
399  void
400  createAttributes(
401  const AttributesType& theAttributes,
402  XalanSourceTreeAttr** theAttributeVector,
403  XalanSourceTreeElement* theOwnerElement,
404  bool fAddXMLNamespaceAttribute);
405 
406  const XalanDOMString&
407  getTextNodeString(
408  const XalanDOMChar* chars,
410 
411  const XalanDOMString*
412  getNamespaceForPrefix(
413  const XalanDOMChar* theName,
414  const PrefixResolver& thePrefixResolver,
415  XalanDOMString& thePrefix,
416  bool fUseDefault,
417  const XalanDOMChar** theLocalName = 0);
418 
419  // Not implemented...
421 
423  operator=(const XalanSourceTreeDocument& theRHS);
424 
425  bool
426  operator==(const XalanSourceTreeDocument& theRHS) const;
427 
428 
429  // Data members...
430  XalanNode* m_firstChild;
431 
432  XalanSourceTreeElement* m_documentElement;
433 
434  XalanSourceTreeAttributeAllocator m_attributeAllocator;
435 
436  XalanSourceTreeAttributeNSAllocator m_attributeNSAllocator;
437 
438  XalanSourceTreeCommentAllocator m_commentAllocator;
439 
440  XalanSourceTreeElementAAllocator m_elementAAllocator;
441 
442  XalanSourceTreeElementANSAllocator m_elementANSAllocator;
443 
444  XalanSourceTreeElementNAAllocator m_elementNAAllocator;
445 
446  XalanSourceTreeElementNANSAllocator m_elementNANSAllocator;
447 
449 
450  XalanSourceTreeTextAllocator m_textAllocator;
451 
452  XalanSourceTreeTextIWSAllocator m_textIWSAllocator;
453 
454  XalanDOMStringPool m_namesStringPool;
455 
456  XalanDOMStringPool m_valuesStringPool;
457 
458  AttributesArrayAllocatorType m_attributesVector;
459 
460  IndexType m_nextIndexValue;
461 
462  const bool m_poolAllText;
463 
464  ElementByIDMapType m_elementsByID;
465 
466  UnparsedEntityURIMapType m_unparsedEntityURIs;
467 
468  XalanDOMStringAllocator m_nonPooledStrings;
469 
470  XalanDOMString m_stringBuffer;
471 
472  static const XalanDOMString& s_nameString;
473 
474  static bool s_poolAllTextNodes;
475 };
476 
477 
478 
479 XALAN_CPP_NAMESPACE_END
480 
481 
482 
483 #endif // !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
virtual XalanElement * getDocumentElement() const =0
Return a reference to the root element of the document.
virtual IndexType getIndex() const =0
Get the node&#39;s index.
XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType
static void setPoolAllTextNodes(bool fPool)
bool operator==(const XalanDocument &theRHS) const
virtual const XalanNodeList * getChildNodes() const =0
Gets a NodeList that contains all children of this node.
virtual XalanNode * getParentNode() const =0
Gets the parent of this node.
virtual XalanElement * getElementById(const XalanDOMString &elementId) const =0
Returns the Element whose ID is given by elementId.
AllocatorType::size_type block_size_type
virtual XalanDocument * getOwnerDocument() const =0
Gets the Document object associated with this node.
XalanDocument & operator=(const XalanDocument &theSource)
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType
virtual const XalanDOMString & getLocalName() const =0
Returns the local part of the qualified name of this node.
XalanSize_t size_type
XalanMap< const XalanDOMChar *, XalanSourceTreeElement * > ElementByIDMapType
XalanArrayAllocator< XalanSourceTreeAttr * > AttributesArrayAllocatorType
XalanMap< XalanDOMString, XalanDOMString > UnparsedEntityURIMapType
virtual const XalanDOMString & getNamespaceURI() const =0
Get the namespace URI of this node, or null if it is unspecified.
XalanDOMStringPool::block_size_type block_size_type
virtual XalanNode * getLastChild() const =0
Gets the last child of this node.
#define XALAN_XALANSOURCETREE_EXPORT
virtual const XalanDOMString & getNodeValue() const =0
Gets the value of this node, depending on its type.
virtual XalanNode * getFirstChild() const =0
Gets the first child of this node.
XalanDOMStringPool::bucket_size_type bucket_size_type
This class defines an interface for classes that resolve namespace prefixes to their URIs...
XalanDOMStringPool::bucket_count_type bucket_count_type
virtual bool isIndexed() const =0
Determine if the document is node-order indexed.
virtual const XalanDOMString & getPrefix() const =0
Get the namespace prefix of this node, or null if it is unspecified.
XalanSourceTreeAttributeAllocator::size_type allocator_size_type
virtual XalanNode * getNextSibling() const =0
Gets the node immediately following this node.
virtual const XalanNamedNodeMap * getAttributes() const =0
Gets a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise...
virtual XalanNode * getPreviousSibling() const =0
Gets the node immediately preceding this node.
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType
virtual const XalanDOMString & getNodeName() const =0
Gets the name of this node, depending on its type.
Xalan implementation of a hashtable.
Definition: XalanMap.hpp:186
XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType
XalanDOMStringHashTable::bucket_size_type bucket_size_type
virtual NodeType getNodeType() const =0
An enum value representing the type of the underlying object.

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