You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/06/07 20:14:01 UTC
cvs commit: xml-xalan/c/src/XercesParserLiaison XercesDocumentBridge.cpp XercesDocumentBridge.hpp
dbertoni 00/06/07 11:14:00
Modified: c/src/XercesParserLiaison XercesDocumentBridge.cpp
XercesDocumentBridge.hpp
Log:
Added function to build bridge nodes.
Revision Changes Path
1.7 +31 -21 xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.cpp
Index: XercesDocumentBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XercesDocumentBridge.cpp 2000/05/26 19:18:25 1.6
+++ XercesDocumentBridge.cpp 2000/06/07 18:13:56 1.7
@@ -100,7 +100,7 @@
XercesDocumentBridge::XercesDocumentBridge(
const DOM_Document& theXercesDocument,
- bool buildBridgeNodes) :
+ bool buildBridge) :
XalanDocument(),
m_xercesDocument(theXercesDocument),
m_navigator(this),
@@ -133,30 +133,12 @@
m_nodes.insert(m_doctype);
}
- if (buildBridgeNodes == true)
+ if (buildBridge == true)
{
// OK, let's build the nodes. This makes things
// thread-safe, so the document can be shared...
- // First, build any children of the document...
- const XalanNode* theChild = getFirstChild();
-
- while(theChild != 0)
- {
- theChild = theChild->getNextSibling();
- }
-
- // OK, now walk everything below the document
- // element...
- const XalanNode* const theDocumentElement =
- getDocumentElement();
-
- if (theDocumentElement != 0)
- {
- NullTreeWalker theTreeWalker;
-
- theTreeWalker.traverse(theDocumentElement, this);
- }
+ buildBridgeNodes();
}
}
@@ -285,6 +267,34 @@
XercesDocumentBridge::mapNode(const DOM_Element& theXercesNode) const
{
return static_cast<XercesElementBridge*>(mapNode(XercesDOM_NodeHack::getImpl(theXercesNode)));
+}
+
+
+
+void
+XercesDocumentBridge::buildBridgeNodes()
+{
+ // First, build any children of the document...
+ const XalanNode* theChild = getFirstChild();
+
+ while(theChild != 0)
+ {
+ // Note that just accessing the sibling is
+ // enough to build the bridge nodes...
+ theChild = theChild->getNextSibling();
+ }
+
+ // OK, now walk everything below the document
+ // element...
+ const XalanNode* const theDocumentElement =
+ getDocumentElement();
+
+ if (theDocumentElement != 0)
+ {
+ NullTreeWalker theTreeWalker;
+
+ theTreeWalker.traverse(theDocumentElement, this);
+ }
}
1.3 +21 -3 xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.hpp
Index: XercesDocumentBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDocumentBridge.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesDocumentBridge.hpp 2000/05/26 19:18:26 1.2
+++ XercesDocumentBridge.hpp 2000/06/07 18:13:56 1.3
@@ -109,18 +109,18 @@
* Constructor for XercesDocumentBridge.
*
* If the document will be shared amongst multiple threads of execution,
- * the parameter buildBridgeNodes must be true. Otherwise, the bridge
+ * the parameter buildBridge must be true. Otherwise, the bridge
* nodes will be built on demand, a process which is not synchronized.
* This could cause serious problems if multiple threads tried to visit
* an unbuilt node at the same time.
*
* @param theXercesDocument The Xerces document to bridge
- * @param buildBridgeNodes If true, all of the bridge nodes will be built during construction.
+ * @param buildBridge If true, all of the bridge nodes will be built during construction.
*
*/
XercesDocumentBridge(
const DOM_Document& theXercesDocument,
- bool buildBridgeNodes = true);
+ bool buildBridge = true);
virtual
~XercesDocumentBridge();
@@ -293,11 +293,29 @@
XalanElement*
mapNode(const DOM_Element& theXercesNode) const;
+ /**
+ *
+ * Get the Xerces DOM_Document that this XercesDocument represents.
+ *
+ * @return the Xerces DOM_Document instance.
+ *
+ */
DOM_Document
getXercesDocument() const
{
return m_xercesDocument;
}
+
+ /**
+ *
+ * Constructor for XercesDocumentBridge.
+ *
+ * Build the entire bridge structure. This should be done before any
+ * processing begins, if the tree will be shared amongst multiple
+ * threads.
+ */
+ void
+ buildBridgeNodes();
private: