Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XercesDocumentWrapper.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 #if !defined(XERCESDOCUMENTWRAPPER_HEADER_GUARD_1357924680)
17 #define XERCESDOCUMENTWRAPPER_HEADER_GUARD_1357924680
18 
19 
20 
22 
23 
24 
26 
27 
28 
30 
31 
32 
33 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
36 #endif
37 
38 
39 
41 
42 
43 
46 
47 
54 
55 
57 
58 
59 
60 XALAN_CPP_NAMESPACE_BEGIN
61 
62 
63 
64 class XalanDOMStringPool;
67 class XercesDocumentFragmentWrapper;
73 
74 
75 
77 {
78 public:
79 
80  friend class XercesWrapperNavigator;
81 
99  MemoryManagerType& theManager,
100  const DOMDocument_Type* theXercesDocument,
101  bool threadSafe = true,
102  bool buildWrapper = true,
103  bool buildMaps = false);
104 
105  static XercesDocumentWrapper*
106  create(
107  MemoryManagerType& theManager,
108  const DOMDocument_Type* theXercesDocument,
109  bool threadSafe,
110  bool buildWrapper,
111  bool buildMaps);
112 
114  getMemoryManager() const
115  {
116  return m_nodeMap.getMemoryManager();
117  }
118 
119  virtual
121 
122  // These interfaces are inherited from XalanNode...
123 
124  virtual const XalanDOMString&
125  getNodeName() const;
126 
127  virtual const XalanDOMString&
128  getNodeValue() const;
129 
130  virtual NodeType
131  getNodeType() const;
132 
133  virtual XalanNode*
134  getParentNode() const;
135 
136  virtual const XalanNodeList*
137  getChildNodes() const;
138 
139  virtual XalanNode*
140  getFirstChild() const;
141 
142  virtual XalanNode*
143  getLastChild() const;
144 
145  virtual XalanNode*
146  getPreviousSibling() const;
147 
148  virtual XalanNode*
149  getNextSibling() const;
150 
151  virtual const XalanNamedNodeMap*
152  getAttributes() const;
153 
154  virtual XalanDocument*
155  getOwnerDocument() const;
156 
157 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
158  virtual XalanNode*
159 #else
160  virtual XercesDocumentWrapper*
161 #endif
162  cloneNode(bool deep) const;
163 
164  virtual XalanNode*
165  insertBefore(
166  XalanNode* newChild,
167  XalanNode* refChild);
168 
169  virtual XalanNode*
170  replaceChild(
171  XalanNode* newChild,
172  XalanNode* oldChild);
173 
174  virtual XalanNode*
175  removeChild(XalanNode* oldChild);
176 
177  virtual XalanNode*
178  appendChild(XalanNode* newChild);
179 
180  virtual bool
181  hasChildNodes() const;
182 
183  virtual void
184  setNodeValue(const XalanDOMString& nodeValue);
185 
186  virtual void
187  normalize();
188 
189  virtual bool
190  isSupported(
191  const XalanDOMString& feature,
192  const XalanDOMString& version) const;
193 
194  virtual const XalanDOMString&
195  getNamespaceURI() const;
196 
197  virtual const XalanDOMString&
198  getPrefix() const;
199 
200  virtual const XalanDOMString&
201  getLocalName() const;
202 
203  virtual void
204  setPrefix(const XalanDOMString& prefix);
205 
206  virtual bool
207  isIndexed() const;
208 
209  virtual IndexType
210  getIndex() const;
211 
212  virtual XalanElement*
213  createElement(const XalanDOMString& tagName);
214 
215  virtual XalanDocumentFragment*
217 
218  virtual XalanText*
219  createTextNode(const XalanDOMString& data);
220 
221  virtual XalanComment*
222  createComment(const XalanDOMString& data);
223 
224  virtual XalanCDATASection*
225  createCDATASection(const XalanDOMString& data);
226 
229  const XalanDOMString& target,
230  const XalanDOMString& data);
231 
232  virtual XalanAttr*
233  createAttribute(const XalanDOMString& name);
234 
235  virtual XalanEntityReference*
237 
238  virtual XalanDocumentType*
239  getDoctype() const;
240 
241  virtual XalanDOMImplementation*
242  getImplementation() const;
243 
244  virtual XalanElement*
245  getDocumentElement() const;
246 
247  virtual XalanNodeList*
248  getElementsByTagName(const XalanDOMString& tagname) const;
249 
250  virtual XalanNode*
251  importNode(
252  XalanNode* importedNode,
253  bool deep);
254 
255  virtual XalanElement*
257  const XalanDOMString& namespaceURI,
258  const XalanDOMString& qualifiedName);
259 
260  virtual XalanAttr*
262  const XalanDOMString& namespaceURI,
263  const XalanDOMString& qualifiedName);
264 
265  virtual XalanNodeList*
267  const XalanDOMString& namespaceURI,
268  const XalanDOMString& localName) const;
269 
270  virtual XalanElement*
271  getElementById(const XalanDOMString& elementId) const;
272 
273  // These are some special interfaces to manage relationships between
274  // our nodes and Xerces nodes.
275 
283  void
284  destroyWrapper();
285 
292  void
293  rebuildWrapper();
294 
305  XalanNode*
306  mapNode(const DOMNodeType* theXercesNode) const;
307 
318  XalanAttr*
319  mapNode(const DOMAttrType* theXercesNode) const;
320 
331  XalanElement*
332  mapNode(const DOMElementType* theXercesNode) const;
333 
344  const DOMNodeType*
345  mapNode(XalanNode* theXalanNode) const;
346 
354  const DOMDocument_Type*
355  getXercesDocument() const
356  {
357  return m_xercesDocument;
358  }
359 
365  void
366  buildWrapperNodes();
367 
369 
370  // Helper class to walk the tree and build everything...
372  {
373  public:
374 
376 
378  XercesDocumentWrapper* theDocument,
379  XercesWrapperNavigator* theDocumentNavigator,
380  IndexType theStartIndex,
381  bool theBuildMapsFlag);
382 
383  virtual
385 
387  {
389  XercesWrapperNavigator* theNavigator = 0,
390  XalanNode* theNode = 0) :
391  m_navigator(theNavigator),
392  m_node(theNode)
393  {
394  }
395 
397 
399  };
400 
402 
403  protected:
404 
405  virtual bool
406  startNode(const DOMNodeType* node);
407 
408  virtual bool
409  endNode(const DOMNodeType* node);
410 
411 #if !defined(XALAN_NO_USING_DECLARATION)
412  using ParentType::startNode;
413  using ParentType::endNode;
414 #endif
415 
416  private:
417 
418  XercesDocumentWrapper* m_document;
419 
420  IndexType m_currentIndex;
421 
422  NavigatorStackType m_parentNavigatorStack;
423 
424  NavigatorStackType m_siblingNavigatorStack;
425 
426  const bool m_buildMaps;
427  };
428 
429 
437  const XalanDOMString&
438  getPooledString(const XalanDOMString& theString) const;
439 
448  const XalanDOMString&
449  getPooledString(
450  const XalanDOMChar* theString,
451  XalanDOMString::size_type theLength /* = XalanDOMString::npos */) const;
452 
453  bool
454  getMappingMode() const
455  {
456  return m_mappingMode;
457  }
458 
459 private:
460 
461  // Destruction API...
462  void
463  destroyWrapperNode(XalanNode* theNode);
464 
465  // Not implemented...
467 
469  operator=(const XercesDocumentWrapper& theRHS);
470 
471  bool
472  operator==(const XercesDocumentWrapper& theRHS) const;
473 
474  // Private delete function...
475  void
476  destroyNode(XalanNode* theNode);
477 
478  // More internal implementation stuff...
479 
480  // Factory methods for our implementation nodes...
481  XalanNode*
482  createWrapperNode(
483  const DOMNodeType* theXercesNode,
484  IndexType theIndex,
485  bool mapNode,
486  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
487 
489  createWrapperNode(
490  const DOMDocumentType_Type* theDoctype,
491  IndexType theIndex,
492  bool mapNode,
493  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
494 
496  createWrapperNode(
497  const DOMElementType* theXercesNode,
498  IndexType theIndex,
499  bool mapNode,
500  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
501 
503  createWrapperNode(
504  const DOMTextType* theXercesNode,
505  IndexType theIndex,
506  bool mapNode,
507  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
508 
510  createWrapperNode(
511  const DOMCommentType* theXercesNode,
512  IndexType theIndex,
513  bool mapNode,
514  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
515 
517  createWrapperNode(
518  const DOMCDATASectionType* theXercesNode,
519  IndexType theIndex,
520  bool mapNode,
521  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
522 
524  createWrapperNode(
525  const DOMProcessingInstructionType* theXercesNode,
526  IndexType theIndex,
527  bool mapNode,
528  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
529 
531  createWrapperNode(
532  const DOMAttrType* theXercesNode,
533  IndexType theIndex,
534  bool mapNode,
535  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
536 
538  createWrapperNode(
539  const DOMEntityType* theXercesNode,
540  IndexType theIndex,
541  bool mapNode,
542  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
543 
545  createWrapperNode(
546  const DOMEntityReferenceType* theXercesNode,
547  IndexType theIndex,
548  bool mapNode,
549  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
550 
552  createWrapperNode(
553  const DOMNotationType* theXercesNode,
554  IndexType theIndex,
555  bool mapNode,
556  XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
557 
559  createNavigator() const;
560 
561  // This is a private helper class for building the tree...
563 
564  const DOMDocument_Type* const m_xercesDocument;
565 
566  XalanElement* m_documentElement;
567 
568  mutable XercesWrapperToXalanNodeMap m_nodeMap;
569 
571 
572  mutable XercesWrapperNavigatorAllocator m_navigatorAllocator;
573 
574  // Our navigator will be the first entry in m_navigators,
575  // but we'll cache this so access is faster...
576  XercesWrapperNavigator* m_navigator;
577 
578  XercesNodeListWrapper m_children;
579 
580  mutable NodeVectorType m_nodes;
581 
582  mutable XercesDocumentTypeWrapper* m_doctype;
583 
584  bool m_mappingMode;
585 
586  bool m_indexValid;
587 
588  const bool m_buildMaps;
589 
590  mutable XercesElementWrapperAllocator m_elementAllocator;
591 
592  mutable XercesTextWrapperAllocator m_textAllocator;
593 
594  mutable XercesAttrWrapperAllocator m_attributeAllocator;
595 
597 };
598 
599 
600 
601 XALAN_CPP_NAMESPACE_END
602 
603 
604 
605 #endif // !defined(XERCESDOCUMENTWRAPPER_HEADER_GUARD_1357924680)

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