Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XercesDocumentBridge.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(XERCESDOCUMENTBRIDGE_HEADER_GUARD_1357924680)
17 #define XERCESDOCUMENTBRIDGE_HEADER_GUARD_1357924680
18 
19 
20 
22 
23 
24 
27 
28 
29 
30 #if XERCES_VERSION_MAJOR >= 2
31 #include <xercesc/dom/deprecated/DOM_Document.hpp>
32 #else
33 #include <xercesc/dom/DOM_Document.hpp>
34 #endif
35 
36 
37 
39 
40 
41 
42 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
45 #endif
46 
47 
48 
50 
51 
52 
54 
55 
56 
64 
65 
66 
67 XALAN_CPP_NAMESPACE_BEGIN
68 
69 
70 
71 class XalanDOMStringPool;
72 class XercesAttrBridge;
78 class XercesEntityBridge;
82 class XercesTextBridge;
83 
84 
91 {
92 public:
93 
94  friend class XercesBridgeNavigator;
95 
112  const DOM_Document_Type& theXercesDocument,
113  bool threadSafe = true,
114  bool buildBridge = true);
115 
116  virtual
118 
119  // These interfaces are inherited from XalanNode...
120 
121  virtual const XalanDOMString&
122  getNodeName() const;
123 
124  virtual const XalanDOMString&
125  getNodeValue() const;
126 
127  virtual NodeType
128  getNodeType() const;
129 
130  virtual XalanNode*
131  getParentNode() const;
132 
133  virtual const XalanNodeList*
134  getChildNodes() const;
135 
136  virtual XalanNode*
137  getFirstChild() const;
138 
139  virtual XalanNode*
140  getLastChild() const;
141 
142  virtual XalanNode*
143  getPreviousSibling() const;
144 
145  virtual XalanNode*
146  getNextSibling() const;
147 
148  virtual const XalanNamedNodeMap*
149  getAttributes() const;
150 
151  virtual XalanDocument*
152  getOwnerDocument() const;
153 
154 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
155  virtual XalanNode*
156 #else
157  virtual XercesDocumentBridge*
158 #endif
159  cloneNode(bool deep) const;
160 
161  virtual XalanNode*
162  insertBefore(
163  XalanNode* newChild,
164  XalanNode* refChild);
165 
166  virtual XalanNode*
167  replaceChild(
168  XalanNode* newChild,
169  XalanNode* oldChild);
170 
171  virtual XalanNode*
172  removeChild(XalanNode* oldChild);
173 
174  virtual XalanNode*
175  appendChild(XalanNode* newChild);
176 
177  virtual bool
178  hasChildNodes() const;
179 
180  virtual void
181  setNodeValue(const XalanDOMString& nodeValue);
182 
183  virtual void
184  normalize();
185 
186  virtual bool
187  isSupported(
188  const XalanDOMString& feature,
189  const XalanDOMString& version) const;
190 
191  virtual const XalanDOMString&
192  getNamespaceURI() const;
193 
194  virtual const XalanDOMString&
195  getPrefix() const;
196 
197  virtual const XalanDOMString&
198  getLocalName() const;
199 
200  virtual void
201  setPrefix(const XalanDOMString& prefix);
202 
203  virtual bool
204  isIndexed() const;
205 
206  virtual IndexType
207  getIndex() const;
208 
209  virtual XalanElement*
210  createElement(const XalanDOMString& tagName);
211 
212  virtual XalanDocumentFragment*
214 
215  virtual XalanText*
216  createTextNode(const XalanDOMString& data);
217 
218  virtual XalanComment*
219  createComment(const XalanDOMString& data);
220 
221  virtual XalanCDATASection*
222  createCDATASection(const XalanDOMString& data);
223 
226  const XalanDOMString& target,
227  const XalanDOMString& data);
228 
229  virtual XalanAttr*
230  createAttribute(const XalanDOMString& name);
231 
232  virtual XalanEntityReference*
234 
235  virtual XalanDocumentType*
236  getDoctype() const;
237 
238  virtual XalanDOMImplementation*
239  getImplementation() const;
240 
241  virtual XalanElement*
242  getDocumentElement() const;
243 
244  virtual XalanNodeList*
245  getElementsByTagName(const XalanDOMString& tagname) const;
246 
247  virtual XalanNode*
248  importNode(
249  XalanNode* importedNode,
250  bool deep);
251 
252  virtual XalanElement*
254  const XalanDOMString& namespaceURI,
255  const XalanDOMString& qualifiedName);
256 
257  virtual XalanAttr*
259  const XalanDOMString& namespaceURI,
260  const XalanDOMString& qualifiedName);
261 
262  virtual XalanNodeList*
264  const XalanDOMString& namespaceURI,
265  const XalanDOMString& localName) const;
266 
267  virtual XalanElement*
268  getElementById(const XalanDOMString& elementId) const;
269 
270  // These are some special interfaces to manage relationships between
271  // our nodes and Xerces nodes.
272 
280  void
281  destroyBridge();
282 
289  void
290  rebuildBridge();
291 
292  XalanNode*
293  mapNode(const DOM_NodeType& theXercesNode) const;
294 
295  XalanAttr*
296  mapNode(const DOM_AttrType& theXercesNode) const;
297 
298  XalanElement*
299  mapNode(const DOM_ElementType& theXercesNode) const;
300 
302  mapNode(const XalanNode* theXalanNode) const;
303 
305  mapNode(const XalanAttr* theXalanNode) const;
306 
307  NodeImplType*
308  mapNodeToImpl(const XalanNode* theXalanNode) const;
309 
318  getXercesDocument() const
319  {
320  return m_xercesDocument;
321  }
322 
328  void
329  buildBridgeNodes();
330 
331 
334 
335 
336  // Helper class to walk the tree and build everything...
338  {
339  public:
340 
342 
344  XercesDocumentBridge* theDocument,
345  XercesBridgeNavigator* theDocumentNavigator,
346  NavigatorBridgeVectorInnerType& theNavigators,
347  IndexType theStartIndex);
348 
349  virtual
351 
353  {
355  XercesBridgeNavigator* theNavigator = 0,
356  XalanNode* theNode = 0) :
357  m_navigator(theNavigator),
358  m_node(theNode)
359  {
360  }
361 
363 
365  };
366 
367 
369 
370  protected:
371 
372  virtual void
373  startNode(const DOM_NodeType& node);
374 
375  virtual void
376  endNode(const DOM_NodeType& node);
377 
378  private:
379 
380  XercesDocumentBridge* m_document;
381 
382  NavigatorBridgeVectorInnerType& m_navigators;
383 
384  IndexType m_currentIndex;
385 
386  NavigatorStackType m_parentNavigatorStack;
387 
388  NavigatorStackType m_siblingNavigatorStack;
389  };
390 
391 
399  const XalanDOMString&
400  getPooledString(const XalanDOMString& theString) const;
401 
410  const XalanDOMString&
411  getPooledString(
412  const XalanDOMChar* theString,
413  XalanDOMString::size_type theLength /* = XalanDOMString::npos */) const;
414 
415 private:
416 
417  XalanNode*
418  mapNode(NodeImplType* theXercesNodeImpl) const;
419 
420  // Destruction API...
421  void
422  destroyBridgeNode(XalanNode* theNode);
423 
424  // Not implemented...
425  XercesDocumentBridge(const XercesDocumentBridge& theSource);
426 
428  operator=(const XercesDocumentBridge& theRHS);
429 
430  bool
431  operator==(const XercesDocumentBridge& theRHS) const;
432 
433  // Private delete function...
434  void
435  destroyNode(XalanNode* theNode);
436 
437  // More internal implementation stuff...
438  XalanNode*
439  internalCloneNode(
440  const XalanNode* theXalanNode,
441  const DOM_NodeType& theXercesNode,
442  bool deep);
443 
444  // Factory methods for our implementation nodes...
445  XalanNode*
446  createBridgeNode(
447  const DOM_NodeType& theXercesNode,
448  IndexType theIndex,
449  bool mapNode) const;
450 
452  createBridgeNode(
453  const DOM_DocumentType_Type& theDoctype,
454  IndexType theIndex,
455  bool mapNode) const;
456 
458  createBridgeNode(
459  const DOM_ElementType& theXercesNode,
460  IndexType theIndex,
461  bool mapNode) const;
462 
464  createBridgeNode(
465  const DOM_DocumentFragmentType& theXercesNode,
466  IndexType theIndex,
467  bool mapNode) const;
468 
470  createBridgeNode(
471  const DOM_TextType& theXercesNode,
472  IndexType theIndex,
473  bool mapNode) const;
474 
476  createBridgeNode(
477  const DOM_CommentType& theXercesNode,
478  IndexType theIndex,
479  bool mapNode) const;
480 
482  createBridgeNode(
483  const DOM_CDATASectionType& theXercesNode,
484  IndexType theIndex,
485  bool mapNode) const;
486 
488  createBridgeNode(
489  const DOM_ProcessingInstructionType& theXercesNode,
490  IndexType theIndex,
491  bool mapNode) const;
492 
494  createBridgeNode(
495  const DOM_AttrType& theXercesNode,
496  IndexType theIndex,
497  bool mapNode) const;
498 
500  createBridgeNode(
501  const DOM_EntityType& theXercesNode,
502  IndexType theIndex,
503  bool mapNode) const;
504 
506  createBridgeNode(
507  const DOM_EntityReferenceType& theXercesNode,
508  IndexType theIndex,
509  bool mapNode) const;
510 
512  createBridgeNode(
513  const DOM_NotationType& theXercesNode,
514  IndexType theIndex,
515  bool mapNode) const;
516 
518  pushNavigator(bool mappingMode) const;
519 
520  // This is a private helper class for building the tree...
521  friend class BuildBridgeTreeWalker;
522 
523  // $$$ ToDo: This is because DOM_Document::getElementById() is not
524  // const...
525  mutable DOM_Document_Type m_xercesDocument;
526 
527  XalanElement* m_documentElement;
528 
529  mutable XercesToXalanNodeMap m_nodeMap;
530 
531  XalanAutoPtr<XalanDOMImplementation> m_domImplementation;
532 
533  mutable NavigatorBridgeVectorType m_navigators;
534 
535  // Our navigator will be the first entry in m_navigators,
536  // but we'll cache this so access is faster...
537  XercesBridgeNavigator* m_navigator;
538 
539  XercesNodeListBridge m_children;
540 
541  mutable NodeVectorType m_nodes;
542 
543  mutable XercesDocumentTypeBridge* m_doctype;
544 
545  bool m_mappingMode;
546 
547  bool m_indexValid;
548 
549  mutable XercesElementBridgeAllocator m_elementAllocator;
550 
551  mutable XercesTextBridgeAllocator m_textAllocator;
552 
553  mutable XercesAttributeBridgeAllocator m_attributeAllocator;
554 
555  const XalanAutoPtr<XalanDOMStringPool> m_stringPool;
556 };
557 
558 
559 
560 XALAN_CPP_NAMESPACE_END
561 
562 
563 
564 #endif // !defined(XERCESDOCUMENTBRIDGE_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