Xalan-C++ API Reference 1.12.0
XercesDocumentBridge.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(XERCESDOCUMENTBRIDGE_HEADER_GUARD_1357924680)
19#define XERCESDOCUMENTBRIDGE_HEADER_GUARD_1357924680
20
21
22
24
25
26
29
30
31
32#if XERCES_VERSION_MAJOR >= 2
33#include <xercesc/dom/deprecated/DOM_Document.hpp>
34#else
35#include <xercesc/dom/DOM_Document.hpp>
36#endif
37
38
39
41
42
43
44#if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
47#endif
48
49
50
52
53
54
56
57
58
66
67
68
69namespace XALAN_CPP_NAMESPACE {
70
71
72
73class XalanDOMStringPool;
74class XercesAttrBridge;
75class XercesCommentBridge;
76class XercesCDATASectionBridge;
77class XercesDocumentFragmentBridge;
78class XercesDocumentTypeBridge;
79class XercesElementBridge;
80class XercesEntityBridge;
81class XercesEntityReferenceBridge;
82class XercesProcessingInstructionBridge;
83class XercesNotationBridge;
84class XercesTextBridge;
85
86
87/**
88 * This class is deprecated.
89 *
90 * @deprecated This class is part of the deprecated Xerces DOM bridge.
91 */
93{
94public:
95
97
98 /**
99 *
100 * Constructor for XercesDocumentBridge.
101 *
102 * If the document will be shared amongst multiple threads of execution,
103 * the parameter buildBridge must be true. Otherwise, the bridge
104 * nodes will be built on demand, a process which is not synchronized.
105 * This could cause serious problems if multiple threads tried to visit
106 * an unbuilt node at the same time.
107 *
108 * @param theXercesDocument The Xerces document to bridge
109 * @param threadSafe If true, the tree can safely be shared amongst multiple threads. (Also implies buildBridge == true)
110 * @param buildBridge If true, all of the bridge nodes will be built during construction.
111 *
112 */
115 bool threadSafe = true,
116 bool buildBridge = true);
117
118 virtual
120
121 // These interfaces are inherited from XalanNode...
122
123 virtual const XalanDOMString&
124 getNodeName() const;
125
126 virtual const XalanDOMString&
128
129 virtual NodeType
130 getNodeType() const;
131
132 virtual XalanNode*
134
135 virtual const XalanNodeList*
137
138 virtual XalanNode*
140
141 virtual XalanNode*
143
144 virtual XalanNode*
146
147 virtual XalanNode*
149
150 virtual const XalanNamedNodeMap*
152
153 virtual XalanDocument*
155
156 virtual XercesDocumentBridge*
157 cloneNode(bool deep) const;
158
159 virtual XalanNode*
163
164 virtual XalanNode*
168
169 virtual XalanNode*
171
172 virtual XalanNode*
174
175 virtual bool
177
178 virtual void
180
181 virtual void
183
184 virtual bool
186 const XalanDOMString& feature,
187 const XalanDOMString& version) const;
188
189 virtual const XalanDOMString&
191
192 virtual const XalanDOMString&
193 getPrefix() const;
194
195 virtual const XalanDOMString&
197
198 virtual void
200
201 virtual bool
202 isIndexed() const;
203
204 virtual IndexType
205 getIndex() const;
206
207 virtual XalanElement*
209
210 virtual XalanDocumentFragment*
212
213 virtual XalanText*
215
216 virtual XalanComment*
218
219 virtual XalanCDATASection*
221
224 const XalanDOMString& target,
225 const XalanDOMString& data);
226
227 virtual XalanAttr*
229
230 virtual XalanEntityReference*
232
233 virtual XalanDocumentType*
234 getDoctype() const;
235
238
239 virtual XalanElement*
241
242 virtual XalanNodeList*
244
245 virtual XalanNode*
248 bool deep);
249
250 virtual XalanElement*
254
255 virtual XalanAttr*
259
260 virtual XalanNodeList*
263 const XalanDOMString& localName) const;
264
265 virtual XalanElement*
267
268 // These are some special interfaces to manage relationships between
269 // our nodes and Xerces nodes.
270
271 /**
272 * Destroy the entire bridge structure that connects
273 * the Xerces document to this XercesDocumentBridge
274 * instance. This will invalidate any pointers to
275 * any nodes in the document (except, of course, the
276 * document itself).
277 */
278 void
280
281 /**
282 * Rebuild the entire bridge structure that connects
283 * the Xerces document to this XercesDocumentBridge
284 * instance. This destroys the bridge before
285 * rebuilding.
286 */
287 void
289
290 XalanNode*
292
293 XalanAttr*
295
298
301
304
307
308 /**
309 *
310 * Get the Xerces DOM_Document that this XercesDocument represents.
311 *
312 * @return the Xerces DOM_Document instance.
313 *
314 */
317 {
318 return m_xercesDocument;
319 }
320
321 /**
322 * Build the entire bridge structure. This should be done before any
323 * processing begins, if the tree will be shared amongst multiple
324 * threads.
325 */
326 void
328
329
332
333
334 // Helper class to walk the tree and build everything...
336 {
337 public:
338
340
346
347 virtual
349
364
365
367
368 protected:
369
370 virtual void
372
373 virtual void
374 endNode(const DOM_NodeType& node);
375
376 private:
377
378 XercesDocumentBridge* m_document;
379
380 NavigatorBridgeVectorInnerType& m_navigators;
381
382 IndexType m_currentIndex;
383
384 NavigatorStackType m_parentNavigatorStack;
385
386 NavigatorStackType m_siblingNavigatorStack;
387 };
388
389
390 /**
391 * Get a pooled string. If the string is not in the pool,
392 * add it.
393 *
394 * @param theString The string to pool.
395 * @return A const reference to the pooled string.
396 */
397 const XalanDOMString&
399
400 /**
401 * Get a pooled string. If the string is not in the pool,
402 * add it.
403 *
404 * @param theString The string to pool.
405 * @param theLength The length of the string. If XalanDOMString::npos, the string is assumed to be null-terminated.
406 * @return A const reference to the pooled string.
407 */
408 const XalanDOMString&
410 const XalanDOMChar* theString,
411 XalanDOMString::size_type theLength /* = XalanDOMString::npos */) const;
412
413private:
414
415 XalanNode*
416 mapNode(NodeImplType* theXercesNodeImpl) const;
417
418 // Destruction API...
419 void
420 destroyBridgeNode(XalanNode* theNode);
421
422 // Not implemented...
424
426 operator=(const XercesDocumentBridge& theRHS);
427
428 bool
430
431 // Private delete function...
432 void
433 destroyNode(XalanNode* theNode);
434
435 // More internal implementation stuff...
436 XalanNode*
437 internalCloneNode(
438 const XalanNode* theXalanNode,
440 bool deep);
441
442 // Factory methods for our implementation nodes...
443 XalanNode*
444 createBridgeNode(
447 bool mapNode) const;
448
450 createBridgeNode(
453 bool mapNode) const;
454
456 createBridgeNode(
459 bool mapNode) const;
460
462 createBridgeNode(
465 bool mapNode) const;
466
468 createBridgeNode(
471 bool mapNode) const;
472
474 createBridgeNode(
477 bool mapNode) const;
478
480 createBridgeNode(
483 bool mapNode) const;
484
486 createBridgeNode(
489 bool mapNode) const;
490
492 createBridgeNode(
495 bool mapNode) const;
496
498 createBridgeNode(
501 bool mapNode) const;
502
504 createBridgeNode(
507 bool mapNode) const;
508
510 createBridgeNode(
513 bool mapNode) const;
514
516 pushNavigator(bool mappingMode) const;
517
518 // This is a private helper class for building the tree...
520
521 // $$$ ToDo: This is because DOM_Document::getElementById() is not
522 // const...
523 mutable DOM_Document_Type m_xercesDocument;
524
525 XalanElement* m_documentElement;
526
527 mutable XercesToXalanNodeMap m_nodeMap;
528
529 XalanAutoPtr<XalanDOMImplementation> m_domImplementation;
530
531 mutable NavigatorBridgeVectorType m_navigators;
532
533 // Our navigator will be the first entry in m_navigators,
534 // but we'll cache this so access is faster...
535 XercesBridgeNavigator* m_navigator;
536
537 XercesNodeListBridge m_children;
538
539 mutable NodeVectorType m_nodes;
540
541 mutable XercesDocumentTypeBridge* m_doctype;
542
543 bool m_mappingMode;
544
545 bool m_indexValid;
546
547 mutable XercesElementBridgeAllocator m_elementAllocator;
548
549 mutable XercesTextBridgeAllocator m_textAllocator;
550
551 mutable XercesAttributeBridgeAllocator m_attributeAllocator;
552
553 const XalanAutoPtr<XalanDOMStringPool> m_stringPool;
554};
555
556
557
558}
559
560
561
562#endif // !defined(XERCESDOCUMENTBRIDGE_HEADER_GUARD_1357924680)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
#define XALAN_XERCESPARSERLIAISON_EXPORT
This class is deprecated.
This class is deprecated.
XalanVector< NavigatorStackEntryType > NavigatorStackType
virtual void startNode(const DOM_NodeType &node)
BuildBridgeTreeWalker(XercesDocumentBridge *theDocument, XercesBridgeNavigator *theDocumentNavigator, NavigatorBridgeVectorInnerType &theNavigators, IndexType theStartIndex)
virtual void endNode(const DOM_NodeType &node)
XalanDeque< XercesBridgeNavigator > NavigatorBridgeVectorType
virtual void setNodeValue(const XalanDOMString &nodeValue)
virtual XalanElement * getElementById(const XalanDOMString &elementId) const
Returns the Element whose ID is given by elementId.
void destroyBridge()
Destroy the entire bridge structure that connects the Xerces document to this XercesDocumentBridge in...
virtual bool isSupported(const XalanDOMString &feature, const XalanDOMString &version) const
virtual const XalanNamedNodeMap * getAttributes() const
Gets a NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
virtual XalanCDATASection * createCDATASection(const XalanDOMString &data)
virtual XalanNode * removeChild(XalanNode *oldChild)
void buildBridgeNodes()
Build the entire bridge structure.
XalanElement * mapNode(const DOM_ElementType &theXercesNode) const
virtual XalanEntityReference * createEntityReference(const XalanDOMString &name)
virtual XalanDocument * getOwnerDocument() const
Gets the Document object associated with this node.
virtual XalanNodeList * getElementsByTagNameNS(const XalanDOMString &namespaceURI, const XalanDOMString &localName) const
virtual const XalanDOMString & getNamespaceURI() const
Get the namespace URI of this node, or null if it is unspecified.
const XalanDOMString & getPooledString(const XalanDOMChar *theString, XalanDOMString::size_type theLength) const
Get a pooled string.
virtual NodeType getNodeType() const
An enum value representing the type of the underlying object.
virtual XalanNode * importNode(XalanNode *importedNode, bool deep)
virtual XalanElement * createElementNS(const XalanDOMString &namespaceURI, const XalanDOMString &qualifiedName)
virtual XalanNode * insertBefore(XalanNode *newChild, XalanNode *refChild)
virtual XalanDocumentType * getDoctype() const
virtual XalanNode * getFirstChild() const
Gets the first child of this node.
virtual XercesDocumentBridge * cloneNode(bool deep) const
virtual XalanNode * replaceChild(XalanNode *newChild, XalanNode *oldChild)
virtual const XalanDOMString & getPrefix() const
Get the namespace prefix of this node, or null if it is unspecified.
virtual XalanNode * getNextSibling() const
Gets the node immediately following this node.
virtual const XalanDOMString & getNodeName() const
Gets the name of this node, depending on its type.
virtual XalanElement * getDocumentElement() const
Return a reference to the root element of the document.
virtual XalanNode * getParentNode() const
Gets the parent of this node.
DOM_AttrType mapNode(const XalanAttr *theXalanNode) const
virtual XalanElement * createElement(const XalanDOMString &tagName)
virtual const XalanNodeList * getChildNodes() const
Gets a NodeList that contains all children of this node.
virtual XalanNode * getPreviousSibling() const
Gets the node immediately preceding this node.
virtual XalanText * createTextNode(const XalanDOMString &data)
NodeImplType * mapNodeToImpl(const XalanNode *theXalanNode) const
virtual XalanAttr * createAttribute(const XalanDOMString &name)
virtual XalanNodeList * getElementsByTagName(const XalanDOMString &tagname) const
XalanAttr * mapNode(const DOM_AttrType &theXercesNode) const
virtual XalanProcessingInstruction * createProcessingInstruction(const XalanDOMString &target, const XalanDOMString &data)
DOM_NodeType mapNode(const XalanNode *theXalanNode) const
const XalanDOMString & getPooledString(const XalanDOMString &theString) const
Get a pooled string.
XalanNode * mapNode(const DOM_NodeType &theXercesNode) const
virtual XalanDOMImplementation * getImplementation() const
virtual bool hasChildNodes() const
virtual XalanComment * createComment(const XalanDOMString &data)
virtual const XalanDOMString & getLocalName() const
Returns the local part of the qualified name of this node.
XalanDeque< XalanNode * > NodeVectorType
DOM_Document_Type getXercesDocument() const
Get the Xerces DOM_Document that this XercesDocument represents.
void rebuildBridge()
Rebuild the entire bridge structure that connects the Xerces document to this XercesDocumentBridge in...
virtual void setPrefix(const XalanDOMString &prefix)
virtual XalanNode * appendChild(XalanNode *newChild)
virtual bool isIndexed() const
Determine if the document is node-order indexed.
virtual XalanNode * getLastChild() const
Gets the last child of this node.
XercesDocumentBridge(const DOM_Document_Type &theXercesDocument, bool threadSafe=true, bool buildBridge=true)
Constructor for XercesDocumentBridge.
virtual XalanAttr * createAttributeNS(const XalanDOMString &namespaceURI, const XalanDOMString &qualifiedName)
virtual const XalanDOMString & getNodeValue() const
Gets the value of this node, depending on its type.
virtual IndexType getIndex() const
Get the node's index.
virtual XalanDocumentFragment * createDocumentFragment()
This class is deprecated.
This class is deprecated.
This class is deprecated.
This class is deprecated.
xercesc::DOM_CDATASection DOM_CDATASectionType
xercesc::NodeImpl NodeImplType
xercesc::DOM_ProcessingInstruction DOM_ProcessingInstructionType
xercesc::DOM_Attr DOM_AttrType
xercesc::DOM_EntityReference DOM_EntityReferenceType
xercesc::DOM_Element DOM_ElementType
xercesc::DOM_Text DOM_TextType
xercesc::DOM_Node DOM_NodeType
xercesc::DOM_Entity DOM_EntityType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
xercesc::DOM_Notation DOM_NotationType
xercesc::DOM_DocumentType DOM_DocumentType_Type
xercesc::DOM_Comment DOM_CommentType
xercesc::DOM_Document DOM_Document_Type
xercesc::DOM_DocumentFragment DOM_DocumentFragmentType
NavigatorStackEntryType(XercesBridgeNavigator *theNavigator=0, XalanNode *theNode=0)