dbertoni 2004/08/12 14:37:56
Modified: c/src/xalanc/XercesParserLiaison XercesDocumentWrapper.cpp
XercesDocumentWrapper.hpp
Log:
Removed use of deque.
Revision Changes Path
1.7 +141 -77
xml-xalan/c/src/xalanc/XercesParserLiaison/XercesDocumentWrapper.cpp
Index: XercesDocumentWrapper.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XercesParserLiaison/XercesDocumentWrapper.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XercesDocumentWrapper.cpp 26 Feb 2004 23:07:14 -0000 1.6
+++ XercesDocumentWrapper.cpp 12 Aug 2004 21:37:56 -0000 1.7
@@ -82,8 +82,8 @@
m_documentElement(0),
m_nodeMap(),
m_domImplementation(new
XercesDOMImplementationWrapper(theXercesDocument->getImplementation())),
- m_navigators(1, XercesWrapperNavigator(this)),
- m_navigator(&m_navigators.front()),
+ m_navigatorAllocator(25),
+ m_navigator(0),
m_children(theXercesDocument->getChildNodes(),
*m_navigator),
m_nodes(),
@@ -98,6 +98,8 @@
{
assert(theXercesDocument != 0);
+ m_navigator = m_navigatorAllocator.create(this);
+
if (m_mappingMode == false)
{
// The document index is always 1...
@@ -321,9 +323,9 @@
m_nodes.clear();
// Clear out all of the navigators, except ours...
- m_navigators.erase(m_navigators.begin() + 1, m_navigators.end());
+ m_navigatorAllocator.reset();
- m_navigator = &m_navigators.front();
+ m_navigator = m_navigatorAllocator.create(this);
// Clear the node map...
m_nodeMap.clear();
@@ -348,7 +350,7 @@
XercesWrapperNavigator&
-XercesDocumentWrapper::pushNavigator() const
+XercesDocumentWrapper::createNavigator() const
{
XercesDocumentWrapper* const This =
#if defined(XALAN_OLD_STYLE_CASTS)
@@ -357,9 +359,7 @@
const_cast<XercesDocumentWrapper*>(this);
#endif
- This->m_navigators.push_back(XercesWrapperNavigator(This));
-
- return This->m_navigators.back();
+ return *This->m_navigatorAllocator.create(This);
}
@@ -368,7 +368,8 @@
XercesDocumentWrapper::createWrapperNode(
const DOMDocumentType_Type* theDoctype,
IndexType
theIndex,
- bool
mapNode) const
+ bool
mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// This is a special case, since there is only one
// doctype node allowed...
@@ -377,7 +378,7 @@
m_xercesDocument->getDoctype() == theDoctype);
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -399,6 +400,11 @@
This->m_nodes.push_back(m_doctype);
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return m_doctype;
}
@@ -406,12 +412,13 @@
XercesElementWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMElementType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const
+ const DOMElementType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -434,6 +441,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -441,12 +453,13 @@
XercesTextWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMTextType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const
+ const DOMTextType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -468,6 +481,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -475,12 +493,13 @@
XercesCommentWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMCommentType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const
+ const DOMCommentType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -504,6 +523,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -513,10 +537,11 @@
XercesDocumentWrapper::createWrapperNode(
const DOMCDATASectionType* theXercesNode,
IndexType
theIndex,
- bool
mapNode) const
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -540,6 +565,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -549,10 +579,11 @@
XercesDocumentWrapper::createWrapperNode(
const DOMProcessingInstructionType*
theXercesNode,
IndexType
theIndex,
- bool
mapNode) const
+ bool
mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator)
const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -576,6 +607,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -583,12 +619,13 @@
XercesAttrWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMAttrType* theXercesNode,
- IndexType theIndex,
- bool /* mapNode */) const
+ const DOMAttrType* theXercesNode,
+ IndexType theIndex,
+ bool /* mapNode */,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -608,6 +645,11 @@
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -615,12 +657,13 @@
XercesEntityWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMEntityType* theXercesNode,
- IndexType theIndex,
- bool /* mapNode */)
const
+ const DOMEntityType* theXercesNode,
+ IndexType theIndex,
+ bool /* mapNode
*/,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -642,6 +685,11 @@
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -651,10 +699,11 @@
XercesDocumentWrapper::createWrapperNode(
const DOMEntityReferenceType* theXercesNode,
IndexType
theIndex,
- bool
mapNode) const
+ bool
mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -678,6 +727,11 @@
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
}
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -685,12 +739,13 @@
XercesNotationWrapper*
XercesDocumentWrapper::createWrapperNode(
- const DOMNotationType* theXercesNode,
- IndexType theIndex,
- bool /* mapNode */)
const
+ const DOMNotationType* theXercesNode,
+ IndexType theIndex,
+ bool /* mapNode
*/,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
// Create a navigator...
- XercesWrapperNavigator& theNavigator = pushNavigator();
+ XercesWrapperNavigator& theNavigator = createNavigator();
theNavigator.setIndex(theIndex);
@@ -712,6 +767,11 @@
// for now...
This->m_nodeMap.addAssociation(theXercesNode, theWrapper);
+ if (theWrapperNodeNavigator != 0)
+ {
+ *theWrapperNodeNavigator = &theNavigator;
+ }
+
return theWrapper;
}
@@ -719,9 +779,10 @@
XalanNode*
XercesDocumentWrapper::createWrapperNode(
- const DOMNodeType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const
+ const DOMNodeType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator) const
{
assert(theXercesNode != 0);
@@ -738,7 +799,7 @@
static_cast<const
DOMAttrType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theAttrNode, theIndex,
mapNode);
+ theNewNode = createWrapperNode(theAttrNode, theIndex,
mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -752,7 +813,7 @@
static_cast<const
DOMCDATASectionType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theCDATASectionNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theCDATASectionNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
@@ -767,7 +828,7 @@
static_cast<const
DOMCommentType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theCommentNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theCommentNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -785,7 +846,7 @@
static_cast<const
DOMElementType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theElementNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theElementNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -799,7 +860,7 @@
static_cast<const
DOMEntityType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theEntityNode, theIndex,
mapNode);
+ theNewNode = createWrapperNode(theEntityNode, theIndex,
mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -813,7 +874,7 @@
static_cast<const
DOMEntityReferenceType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theEntityReferenceNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theEntityReferenceNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -827,7 +888,7 @@
static_cast<const
DOMNotationType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theNotationNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theNotationNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -841,7 +902,7 @@
static_cast<const
DOMProcessingInstructionType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(thePINode, theIndex,
mapNode);
+ theNewNode = createWrapperNode(thePINode, theIndex,
mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -855,7 +916,7 @@
static_cast<const
DOMTextType*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theTextNode, theIndex,
mapNode);
+ theNewNode = createWrapperNode(theTextNode, theIndex,
mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
break;
@@ -869,7 +930,7 @@
static_cast<const
DOMDocumentType_Type*>(theXercesNode);
#endif
- theNewNode = createWrapperNode(theDoctypeNode,
theIndex, mapNode);
+ theNewNode = createWrapperNode(theDoctypeNode,
theIndex, mapNode, theWrapperNodeNavigator);
assert(theNewNode != 0);
}
@@ -1358,15 +1419,13 @@
if (theStartChild != 0)
{
assert(m_navigator != 0);
- assert(m_navigators.size() == 1);
m_navigator->setIndex(1);
m_navigator->setFirstChild(0);
BuildWrapperTreeWalker theTreeWalker(
this,
- &m_navigators.back(),
- m_navigators,
+ m_navigator,
2,
m_buildMaps);
@@ -1395,13 +1454,11 @@
XercesDocumentWrapper::BuildWrapperTreeWalker::BuildWrapperTreeWalker(
- XercesDocumentWrapper* theDocument,
- XercesWrapperNavigator*
theDocumentNavigator,
- WrapperNavigatorVectorType& theNavigators,
- IndexType
theStartIndex,
- bool
theBuildMapsFlag) :
+ XercesDocumentWrapper* theDocument,
+ XercesWrapperNavigator*
theDocumentNavigator,
+ IndexType
theStartIndex,
+ bool
theBuildMapsFlag) :
m_document(theDocument),
- m_navigators(theNavigators),
m_currentIndex(theStartIndex),
m_parentNavigatorStack(),
m_siblingNavigatorStack(),
@@ -1431,10 +1488,15 @@
bool
XercesDocumentWrapper::BuildWrapperTreeWalker::startNode(const DOMNodeType*
node)
{
- XalanNode* const theWrapperNode =
- m_document->createWrapperNode(node, m_currentIndex,
m_buildMaps);
+ XercesWrapperNavigator* theWrapperNodeNavigator;
- XercesWrapperNavigator& theCurrentNodeNavigator = m_navigators.back();
+ XalanNode* const theWrapperNode =
+ m_document->createWrapperNode(
+ node,
+ m_currentIndex,
+ m_buildMaps,
+ &theWrapperNodeNavigator);
+ assert(theWrapperNodeNavigator != 0);
assert(m_parentNavigatorStack.empty() == false);
assert(m_siblingNavigatorStack.empty() == false);
@@ -1443,7 +1505,7 @@
NavigatorStackEntryType& theParentEntry =
m_parentNavigatorStack.back();
NavigatorStackEntryType& theSiblingEntry =
m_siblingNavigatorStack.back();
- theCurrentNodeNavigator.setParentNode(theParentEntry.m_node);
+ theWrapperNodeNavigator->setParentNode(theParentEntry.m_node);
// If the first child has not been set, then set it
// now...
@@ -1457,7 +1519,7 @@
// Always set the last child...
theParentEntry.m_navigator->setLastChild(theWrapperNode);
- theCurrentNodeNavigator.setPreviousSibling(theSiblingEntry.m_node);
+ theWrapperNodeNavigator->setPreviousSibling(theSiblingEntry.m_node);
if (theSiblingEntry.m_navigator != 0)
{
@@ -1465,7 +1527,7 @@
}
// Build an entry for the stacks...
- const NavigatorStackEntryType
theCurrentEntry(&theCurrentNodeNavigator, theWrapperNode);
+ const NavigatorStackEntryType
theCurrentEntry(theWrapperNodeNavigator, theWrapperNode);
// My child nodes will now be visited, so push the current
// context on the parent stack...
@@ -1532,31 +1594,33 @@
const DOMNodeType* const theAttr =
theAttributes->item(i);
assert(theAttr != 0);
+ XercesWrapperNavigator* theCurrentAttrNavigator;
+
// Create a wrapper node.
XalanNode* const theCurrentAttr =
- m_document->createWrapperNode(theAttr,
m_currentIndex, m_buildMaps);
- assert(theCurrentAttr != 0);
-
- // Get the attribute node's navigator...
- XercesWrapperNavigator& theCurrentAttrNavigator =
- m_navigators.back();
+ m_document->createWrapperNode(
+ theAttr,
+ m_currentIndex,
+ m_buildMaps,
+ &theCurrentAttrNavigator);
+ assert(theCurrentAttr != 0 && theCurrentAttrNavigator
!= 0);
// Set the parent node...
- theCurrentAttrNavigator.setParentNode(theWrapperNode);
+ theCurrentAttrNavigator->setParentNode(theWrapperNode);
if (thePreviousAttr != 0)
{
assert(thePreviousAttrNavigator != 0);
// Link in the previous attribute...
-
theCurrentAttrNavigator.setPreviousSibling(thePreviousAttr);
+
theCurrentAttrNavigator->setPreviousSibling(thePreviousAttr);
thePreviousAttrNavigator->setNextSibling(theCurrentAttr);
}
// Update the pointers so they point to this
attribute...
thePreviousAttr = theCurrentAttr;
- thePreviousAttrNavigator = &theCurrentAttrNavigator;
+ thePreviousAttrNavigator = theCurrentAttrNavigator;
// Finally, increment the index...
++m_currentIndex;
1.6 +477 -483
xml-xalan/c/src/xalanc/XercesParserLiaison/XercesDocumentWrapper.hpp
Index: XercesDocumentWrapper.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XercesParserLiaison/XercesDocumentWrapper.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XercesDocumentWrapper.hpp 31 Jul 2004 06:05:11 -0000 1.5
+++ XercesDocumentWrapper.hpp 12 Aug 2004 21:37:56 -0000 1.6
@@ -22,11 +22,6 @@
-#include <deque>
-#include <set>
-
-
-
#include <xalanc/Include/XalanVector.hpp>
@@ -55,7 +50,7 @@
#include <xalanc/XercesParserLiaison/XercesAttrWrapperAllocator.hpp>
#include <xalanc/XercesParserLiaison/XercesElementWrapperAllocator.hpp>
#include <xalanc/XercesParserLiaison/XercesTextWrapperAllocator.hpp>
-
+#include <xalanc/XercesParserLiaison/XercesWrapperNavigatorAllocator.hpp>
#include <xalanc/XercesParserLiaison/XercesWrapperTypes.hpp>
@@ -82,509 +77,508 @@
{
public:
- friend class XercesWrapperNavigator;
+ friend class XercesWrapperNavigator;
- /**
- *
- * Constructor for XercesDocumentWrapper.
- *
- * If the document will be shared amongst multiple threads of execution,
- * the parameter buildWrapper 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 threadSafe If true, the tree can safely be shared amongst
multiple threads. (Also implies buildWrapper == true)
- * @param buildWrapper If true, all of the bridge nodes will be built
during construction.
- * @param buildMaps If true, a map of Xerces to Xalan nodes will be
built, even if the bridge is built
- *
- */
- XercesDocumentWrapper(
- const DOMDocument_Type* theXercesDocument,
- bool
threadSafe = true,
- bool
buildWrapper = true,
- bool
buildMaps = false);
-
- virtual
- ~XercesDocumentWrapper();
-
- // These interfaces are inherited from XalanNode...
-
- virtual const XalanDOMString&
- getNodeName() const;
-
- virtual const XalanDOMString&
- getNodeValue() const;
-
- virtual NodeType
- getNodeType() const;
-
- virtual XalanNode*
- getParentNode() const;
-
- virtual const XalanNodeList*
- getChildNodes() const;
-
- virtual XalanNode*
- getFirstChild() const;
-
- virtual XalanNode*
- getLastChild() const;
-
- virtual XalanNode*
- getPreviousSibling() const;
+ /**
+ *
+ * Constructor for XercesDocumentWrapper.
+ *
+ * If the document will be shared amongst multiple threads of execution,
+ * the parameter buildWrapper 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 threadSafe If true, the tree can safely be shared amongst
multiple threads. (Also implies buildWrapper == true)
+ * @param buildWrapper If true, all of the bridge nodes will be built
during construction.
+ * @param buildMaps If true, a map of Xerces to Xalan nodes will be
built, even if the bridge is built
+ *
+ */
+ XercesDocumentWrapper(
+ const DOMDocument_Type* theXercesDocument,
+ bool threadSafe = true,
+ bool buildWrapper = true,
+ bool buildMaps = false);
+
+ virtual
+ ~XercesDocumentWrapper();
+
+ // These interfaces are inherited from XalanNode...
+
+ virtual const XalanDOMString&
+ getNodeName() const;
+
+ virtual const XalanDOMString&
+ getNodeValue() const;
+
+ virtual NodeType
+ getNodeType() const;
+
+ virtual XalanNode*
+ getParentNode() const;
+
+ virtual const XalanNodeList*
+ getChildNodes() const;
+
+ virtual XalanNode*
+ getFirstChild() const;
+
+ virtual XalanNode*
+ getLastChild() const;
+
+ virtual XalanNode*
+ getPreviousSibling() const;
- virtual XalanNode*
- getNextSibling() const;
+ virtual XalanNode*
+ getNextSibling() const;
- virtual const XalanNamedNodeMap*
- getAttributes() const;
+ virtual const XalanNamedNodeMap*
+ getAttributes() const;
- virtual XalanDocument*
- getOwnerDocument() const;
+ virtual XalanDocument*
+ getOwnerDocument() const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual XalanNode*
-#else
- virtual XercesDocumentWrapper*
-#endif
- cloneNode(bool deep) const;
-
- virtual XalanNode*
- insertBefore(
- XalanNode* newChild,
- XalanNode* refChild);
-
- virtual XalanNode*
- replaceChild(
- XalanNode* newChild,
- XalanNode* oldChild);
-
- virtual XalanNode*
- removeChild(XalanNode* oldChild);
-
- virtual XalanNode*
- appendChild(XalanNode* newChild);
-
- virtual bool
- hasChildNodes() const;
-
- virtual void
- setNodeValue(const XalanDOMString& nodeValue);
-
- virtual void
- normalize();
-
- virtual bool
- isSupported(
- const XalanDOMString& feature,
- const XalanDOMString& version) const;
-
- virtual const XalanDOMString&
- getNamespaceURI() const;
-
- virtual const XalanDOMString&
- getPrefix() const;
-
- virtual const XalanDOMString&
- getLocalName() const;
-
- virtual void
- setPrefix(const XalanDOMString& prefix);
-
- virtual bool
- isIndexed() const;
-
- virtual IndexType
- getIndex() const;
-
- virtual XalanElement*
- createElement(const XalanDOMString& tagName);
-
- virtual XalanDocumentFragment*
- createDocumentFragment();
-
- virtual XalanText*
- createTextNode(const XalanDOMString& data);
-
- virtual XalanComment*
- createComment(const XalanDOMString& data);
-
- virtual XalanCDATASection*
- createCDATASection(const XalanDOMString& data);
-
- virtual XalanProcessingInstruction*
- createProcessingInstruction(
- const XalanDOMString& target,
- const XalanDOMString& data);
-
- virtual XalanAttr*
- createAttribute(const XalanDOMString& name);
-
- virtual XalanEntityReference*
- createEntityReference(const XalanDOMString& name);
-
- virtual XalanDocumentType*
- getDoctype() const;
-
- virtual XalanDOMImplementation*
- getImplementation() const;
-
- virtual XalanElement*
- getDocumentElement() const;
-
- virtual XalanNodeList*
- getElementsByTagName(const XalanDOMString& tagname) const;
-
- virtual XalanNode*
- importNode(
- XalanNode* importedNode,
- bool deep);
-
- virtual XalanElement*
- createElementNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& qualifiedName);
-
- virtual XalanAttr*
- createAttributeNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& qualifiedName);
-
- virtual XalanNodeList*
- getElementsByTagNameNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const;
-
- virtual XalanElement*
- getElementById(const XalanDOMString& elementId) const;
-
- // These are some special interfaces to manage relationships between
- // our nodes and Xerces nodes.
-
- /**
- * Destroy the entire bridge structure that connects
- * the Xerces document to this XercesDocumentWrapper
- * instance. This will invalidate any pointers to
- * any nodes in the document (except, of course, the
- * document itself).
- */
- void
- destroyWrapper();
-
- /**
- * Rebuild the entire bridge structure that connects
- * the Xerces document to this XercesDocumentWrapper
- * instance. This destroys the bridge before
- * rebuilding.
- */
- void
- rebuildWrapper();
-
- /**
- * Map a Xerces node to the corresponding wrapper node.
- * If the constructor for the instance was called with
- * the threadSafe or buildWrapper parameter equal to
- * true, this call will fail.
- *
- * @param theXercesNode The Xerces instance to map
- *
- * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
- */
- XalanNode*
- mapNode(const DOMNodeType* theXercesNode) const;
-
- /**
- * Map a Xerces node to the corresponding wrapper node.
- * If the constructor for the instance was called with
- * the threadSafe or buildWrapper parameter equal to
- * true, this call will fail.
- *
- * @param theXercesNode The Xerces instance to map
- *
- * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
- */
- XalanAttr*
- mapNode(const DOMAttrType* theXercesNode) const;
-
- /**
- * Map a Xerces node to the corresponding wrapper node.
- * If the constructor for the instance was called with
- * the threadSafe or buildWrapper parameter equal to
- * true, this call will fail.
- *
- * @param theXercesNode The Xerces instance to map
- *
- * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
- */
- XalanElement*
- mapNode(const DOMElementType* theXercesNode) const;
-
- /**
- * Map a XalanNode to the corresponding Xerces node.
- * If the node not owned by this document, the
- * function will throw XalanDOMException with the code
- * WRONG_DOCUMENT_ERR.
- *
- * @param theXalanNode The Xalan instance to map
- *
- * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
- */
- const DOMNodeType*
- mapNode(XalanNode* theXalanNode) const;
-
- /**
- *
- * Get the Xerces DOMDocument that this XercesDocument represents.
- *
- * @return the Xerces DOMDocument instance.
- *
- */
- const DOMDocument_Type*
- getXercesDocument() const
- {
- return m_xercesDocument;
- }
-
- /**
- * Build the entire bridge structure. This should be done before any
- * processing begins, if the tree will be shared amongst multiple
- * threads.
- */
- void
- buildWrapperNodes();
-
-#if defined(XALAN_NO_STD_NAMESPACE)
- typedef deque<XercesWrapperNavigator> WrapperNavigatorVectorType;
-
- typedef deque<XalanNode*> NodeVectorType;
+ virtual XalanNode*
#else
- typedef std::deque<XercesWrapperNavigator>
WrapperNavigatorVectorType;
-
- typedef std::deque<XalanNode*> NodeVectorType;
+ virtual XercesDocumentWrapper*
#endif
+ cloneNode(bool deep) const;
- // Helper class to walk the tree and build everything...
- class BuildWrapperTreeWalker : public XercesDOMWalker
- {
- public:
-
- typedef XercesDOMWalker ParentType;
- typedef WrapperNavigatorVectorType
WrapperNavigatorVectorInnerType;
-
- BuildWrapperTreeWalker(
- XercesDocumentWrapper*
theDocument,
- XercesWrapperNavigator*
theDocumentNavigator,
- WrapperNavigatorVectorInnerType&
theNavigators,
- IndexType
theStartIndex,
- bool
theBuildMapsFlag);
-
- virtual
- ~BuildWrapperTreeWalker();
-
- struct NavigatorStackEntryType
- {
- NavigatorStackEntryType(
- XercesWrapperNavigator*
theNavigator = 0,
- XalanNode*
theNode = 0) :
- m_navigator(theNavigator),
- m_node(theNode)
- {
- }
-
- XercesWrapperNavigator* m_navigator;
-
- XalanNode* m_node;
- };
-
- typedef XalanVector<NavigatorStackEntryType>
NavigatorStackType;
+ virtual XalanNode*
+ insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild);
+
+ virtual XalanNode*
+ replaceChild(
+ XalanNode* newChild,
+ XalanNode* oldChild);
+
+ virtual XalanNode*
+ removeChild(XalanNode* oldChild);
+
+ virtual XalanNode*
+ appendChild(XalanNode* newChild);
+
+ virtual bool
+ hasChildNodes() const;
+
+ virtual void
+ setNodeValue(const XalanDOMString& nodeValue);
+
+ virtual void
+ normalize();
+
+ virtual bool
+ isSupported(
+ const XalanDOMString& feature,
+ const XalanDOMString& version) const;
+
+ virtual const XalanDOMString&
+ getNamespaceURI() const;
+
+ virtual const XalanDOMString&
+ getPrefix() const;
+
+ virtual const XalanDOMString&
+ getLocalName() const;
+
+ virtual void
+ setPrefix(const XalanDOMString& prefix);
+
+ virtual bool
+ isIndexed() const;
+
+ virtual IndexType
+ getIndex() const;
+
+ virtual XalanElement*
+ createElement(const XalanDOMString& tagName);
+
+ virtual XalanDocumentFragment*
+ createDocumentFragment();
+
+ virtual XalanText*
+ createTextNode(const XalanDOMString& data);
+
+ virtual XalanComment*
+ createComment(const XalanDOMString& data);
+
+ virtual XalanCDATASection*
+ createCDATASection(const XalanDOMString& data);
+
+ virtual XalanProcessingInstruction*
+ createProcessingInstruction(
+ const XalanDOMString& target,
+ const XalanDOMString& data);
+
+ virtual XalanAttr*
+ createAttribute(const XalanDOMString& name);
+
+ virtual XalanEntityReference*
+ createEntityReference(const XalanDOMString& name);
+
+ virtual XalanDocumentType*
+ getDoctype() const;
+
+ virtual XalanDOMImplementation*
+ getImplementation() const;
+
+ virtual XalanElement*
+ getDocumentElement() const;
+
+ virtual XalanNodeList*
+ getElementsByTagName(const XalanDOMString& tagname) const;
+
+ virtual XalanNode*
+ importNode(
+ XalanNode* importedNode,
+ bool deep);
+
+ virtual XalanElement*
+ createElementNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& qualifiedName);
+
+ virtual XalanAttr*
+ createAttributeNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& qualifiedName);
+
+ virtual XalanNodeList*
+ getElementsByTagNameNS(
+ const XalanDOMString& namespaceURI,
+ const XalanDOMString& localName) const;
+
+ virtual XalanElement*
+ getElementById(const XalanDOMString& elementId) const;
+
+ // These are some special interfaces to manage relationships between
+ // our nodes and Xerces nodes.
+
+ /**
+ * Destroy the entire bridge structure that connects
+ * the Xerces document to this XercesDocumentWrapper
+ * instance. This will invalidate any pointers to
+ * any nodes in the document (except, of course, the
+ * document itself).
+ */
+ void
+ destroyWrapper();
+
+ /**
+ * Rebuild the entire bridge structure that connects
+ * the Xerces document to this XercesDocumentWrapper
+ * instance. This destroys the bridge before
+ * rebuilding.
+ */
+ void
+ rebuildWrapper();
+
+ /**
+ * Map a Xerces node to the corresponding wrapper node.
+ * If the constructor for the instance was called with
+ * the threadSafe or buildWrapper parameter equal to
+ * true, this call will fail.
+ *
+ * @param theXercesNode The Xerces instance to map
+ *
+ * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
+ */
+ XalanNode*
+ mapNode(const DOMNodeType* theXercesNode) const;
+
+ /**
+ * Map a Xerces node to the corresponding wrapper node.
+ * If the constructor for the instance was called with
+ * the threadSafe or buildWrapper parameter equal to
+ * true, this call will fail.
+ *
+ * @param theXercesNode The Xerces instance to map
+ *
+ * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
+ */
+ XalanAttr*
+ mapNode(const DOMAttrType* theXercesNode) const;
+
+ /**
+ * Map a Xerces node to the corresponding wrapper node.
+ * If the constructor for the instance was called with
+ * the threadSafe or buildWrapper parameter equal to
+ * true, this call will fail.
+ *
+ * @param theXercesNode The Xerces instance to map
+ *
+ * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
+ */
+ XalanElement*
+ mapNode(const DOMElementType* theXercesNode) const;
+
+ /**
+ * Map a XalanNode to the corresponding Xerces node.
+ * If the node not owned by this document, the
+ * function will throw XalanDOMException with the code
+ * WRONG_DOCUMENT_ERR.
+ *
+ * @param theXalanNode The Xalan instance to map
+ *
+ * @return The pointer to the corresponding XalanNode instance, or 0 if
the node could not be mapped.
+ */
+ const DOMNodeType*
+ mapNode(XalanNode* theXalanNode) const;
+
+ /**
+ *
+ * Get the Xerces DOMDocument that this XercesDocument represents.
+ *
+ * @return the Xerces DOMDocument instance.
+ *
+ */
+ const DOMDocument_Type*
+ getXercesDocument() const
+ {
+ return m_xercesDocument;
+ }
+
+ /**
+ * Build the entire bridge structure. This should be done before any
+ * processing begins, if the tree will be shared amongst multiple
+ * threads.
+ */
+ void
+ buildWrapperNodes();
+
+ typedef XalanVector<XalanNode*> NodeVectorType;
+
+ // Helper class to walk the tree and build everything...
+ class BuildWrapperTreeWalker : public XercesDOMWalker
+ {
+ public:
+
+ typedef XercesDOMWalker ParentType;
+
+ BuildWrapperTreeWalker(
+ XercesDocumentWrapper* theDocument,
+ XercesWrapperNavigator* theDocumentNavigator,
+ IndexType theStartIndex,
+ bool theBuildMapsFlag);
+
+ virtual
+ ~BuildWrapperTreeWalker();
+
+ struct NavigatorStackEntryType
+ {
+ NavigatorStackEntryType(
+ XercesWrapperNavigator* theNavigator = 0,
+ XalanNode* theNode = 0) :
+ m_navigator(theNavigator),
+ m_node(theNode)
+ {
+ }
+
+ XercesWrapperNavigator* m_navigator;
+
+ XalanNode* m_node;
+ };
+
+ typedef XalanVector<NavigatorStackEntryType>
NavigatorStackType;
- protected:
+ protected:
- virtual bool
- startNode(const DOMNodeType* node);
+ virtual bool
+ startNode(const DOMNodeType* node);
- virtual bool
- endNode(const DOMNodeType* node);
+ virtual bool
+ endNode(const DOMNodeType* node);
#if !defined(XALAN_NO_USING_DECLARATION)
- using ParentType::startNode;
- using ParentType::endNode;
+ using ParentType::startNode;
+ using ParentType::endNode;
#endif
- private:
+ private:
- XercesDocumentWrapper* m_document;
+ XercesDocumentWrapper* m_document;
- WrapperNavigatorVectorInnerType& m_navigators;
+ IndexType m_currentIndex;
- IndexType
m_currentIndex;
+ NavigatorStackType m_parentNavigatorStack;
- NavigatorStackType
m_parentNavigatorStack;
-
- NavigatorStackType
m_siblingNavigatorStack;
-
- const bool
m_buildMaps;
- };
-
-
- /**
- * Get a pooled string. If the string is not in the pool,
- * add it.
- *
- * @param theString The string to pool.
- * @return A const reference to the pooled string.
- */
- const XalanDOMString&
- getPooledString(const XalanDOMString& theString) const;
-
- /**
- * Get a pooled string. If the string is not in the pool,
- * add it.
- *
- * @param theString The string to pool.
- * @param theLength The length of the string. If XalanDOMString::npos,
the string is assumed to be null-terminated.
- * @return A const reference to the pooled string.
- */
- const XalanDOMString&
- getPooledString(
- const XalanDOMChar* theString,
- XalanDOMString::size_type theLength /* =
XalanDOMString::npos */) const;
-
- bool
- getMappingMode() const
- {
- return m_mappingMode;
- }
+ NavigatorStackType m_siblingNavigatorStack;
+
+ const bool m_buildMaps;
+ };
+
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(const XalanDOMString& theString) const;
+
+ /**
+ * Get a pooled string. If the string is not in the pool,
+ * add it.
+ *
+ * @param theString The string to pool.
+ * @param theLength The length of the string. If XalanDOMString::npos,
the string is assumed to be null-terminated.
+ * @return A const reference to the pooled string.
+ */
+ const XalanDOMString&
+ getPooledString(
+ const XalanDOMChar* theString,
+ XalanDOMString::size_type theLength /* = XalanDOMString::npos
*/) const;
+
+ bool
+ getMappingMode() const
+ {
+ return m_mappingMode;
+ }
private:
- // Destruction API...
- void
- destroyWrapperNode(XalanNode* theNode);
-
- // Not implemented...
- XercesDocumentWrapper(const XercesDocumentWrapper& theSource);
-
- XercesDocumentWrapper&
- operator=(const XercesDocumentWrapper& theRHS);
-
- bool
- operator==(const XercesDocumentWrapper& theRHS) const;
-
- // Private delete function...
- void
- destroyNode(XalanNode* theNode);
-
- // More internal implementation stuff...
-
- // Factory methods for our implementation nodes...
- XalanNode*
- createWrapperNode(
- const DOMNodeType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesDocumentTypeWrapper*
- createWrapperNode(
- const DOMDocumentType_Type* theDoctype,
- IndexType
theIndex,
- bool
mapNode) const;
-
- XercesElementWrapper*
- createWrapperNode(
- const DOMElementType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesTextWrapper*
- createWrapperNode(
- const DOMTextType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesCommentWrapper*
- createWrapperNode(
- const DOMCommentType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesCDATASectionWrapper*
- createWrapperNode(
- const DOMCDATASectionType* theXercesNode,
- IndexType
theIndex,
- bool
mapNode) const;
-
- XercesProcessingInstructionWrapper*
- createWrapperNode(
- const DOMProcessingInstructionType*
theXercesNode,
- IndexType
theIndex,
- bool
mapNode) const;
-
- XercesAttrWrapper*
- createWrapperNode(
- const DOMAttrType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesEntityWrapper*
- createWrapperNode(
- const DOMEntityType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesEntityReferenceWrapper*
- createWrapperNode(
- const DOMEntityReferenceType* theXercesNode,
- IndexType
theIndex,
- bool
mapNode) const;
-
- XercesNotationWrapper*
- createWrapperNode(
- const DOMNotationType* theXercesNode,
- IndexType theIndex,
- bool mapNode) const;
-
- XercesWrapperNavigator&
- pushNavigator() const;
-
- // This is a private helper class for building the tree...
- friend class BuildWrapperTreeWalker;
-
- const DOMDocument_Type* const m_xercesDocument;
-
- XalanElement*
m_documentElement;
-
- mutable XercesWrapperToXalanNodeMap m_nodeMap;
-
- XalanAutoPtr<XalanDOMImplementation> m_domImplementation;
-
- mutable WrapperNavigatorVectorType m_navigators;
-
- // Our navigator will be the first entry in m_navigators,
- // but we'll cache this so access is faster...
- XercesWrapperNavigator* m_navigator;
-
- XercesNodeListWrapper m_children;
-
- mutable NodeVectorType m_nodes;
-
- mutable XercesDocumentTypeWrapper* m_doctype;
-
- bool
m_mappingMode;
-
- bool
m_indexValid;
-
- const bool
m_buildMaps;
+ // Destruction API...
+ void
+ destroyWrapperNode(XalanNode* theNode);
+
+ // Not implemented...
+ XercesDocumentWrapper(const XercesDocumentWrapper& theSource);
+
+ XercesDocumentWrapper&
+ operator=(const XercesDocumentWrapper& theRHS);
+
+ bool
+ operator==(const XercesDocumentWrapper& theRHS) const;
+
+ // Private delete function...
+ void
+ destroyNode(XalanNode* theNode);
+
+ // More internal implementation stuff...
+
+ // Factory methods for our implementation nodes...
+ XalanNode*
+ createWrapperNode(
+ const DOMNodeType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesDocumentTypeWrapper*
+ createWrapperNode(
+ const DOMDocumentType_Type* theDoctype,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0)
const;
+
+ XercesElementWrapper*
+ createWrapperNode(
+ const DOMElementType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesTextWrapper*
+ createWrapperNode(
+ const DOMTextType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesCommentWrapper*
+ createWrapperNode(
+ const DOMCommentType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesCDATASectionWrapper*
+ createWrapperNode(
+ const DOMCDATASectionType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesProcessingInstructionWrapper*
+ createWrapperNode(
+ const DOMProcessingInstructionType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator
= 0) const;
+
+ XercesAttrWrapper*
+ createWrapperNode(
+ const DOMAttrType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesEntityWrapper*
+ createWrapperNode(
+ const DOMEntityType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesEntityReferenceWrapper*
+ createWrapperNode(
+ const DOMEntityReferenceType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0)
const;
+
+ XercesNotationWrapper*
+ createWrapperNode(
+ const DOMNotationType* theXercesNode,
+ IndexType theIndex,
+ bool mapNode,
+ XercesWrapperNavigator** theWrapperNodeNavigator = 0) const;
+
+ XercesWrapperNavigator&
+ createNavigator() const;
+
+ // This is a private helper class for building the tree...
+ friend class BuildWrapperTreeWalker;
+
+ const DOMDocument_Type* const m_xercesDocument;
+
+ XalanElement* m_documentElement;
+
+ mutable XercesWrapperToXalanNodeMap m_nodeMap;
+
+ XalanAutoPtr<XalanDOMImplementation> m_domImplementation;
+
+ mutable XercesWrapperNavigatorAllocator m_navigatorAllocator;
+
+ // Our navigator will be the first entry in m_navigators,
+ // but we'll cache this so access is faster...
+ XercesWrapperNavigator* m_navigator;
+
+ XercesNodeListWrapper m_children;
+
+ mutable NodeVectorType m_nodes;
+
+ mutable XercesDocumentTypeWrapper* m_doctype;
+
+ bool m_mappingMode;
+
+ bool m_indexValid;
+
+ const bool m_buildMaps;
- mutable XercesElementWrapperAllocator m_elementAllocator;
+ mutable XercesElementWrapperAllocator m_elementAllocator;
- mutable XercesTextWrapperAllocator m_textAllocator;
+ mutable XercesTextWrapperAllocator m_textAllocator;
- mutable XercesAttrWrapperAllocator m_attributeAllocator;
+ mutable XercesAttrWrapperAllocator m_attributeAllocator;
- const XalanAutoPtr<XalanDOMStringPool> m_stringPool;
+ const XalanAutoPtr<XalanDOMStringPool> m_stringPool;
};
@@ -593,4 +587,4 @@
-#endif // !defined(XERCESDOCUMENTWRAPPER_HEADER_GUARD_1357924680)
+#endif // !defined(XERCESDOCUMENTWRAPPER_HEADER_GUARD_1357924680)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]