dbertoni 2003/03/13 15:53:38
Modified: c/samples/SimpleXPathAPI SimpleXPathAPI.cpp
Log:
Use context node, or its closest ancestor Element for namespace bindings.
Revision Changes Path
1.11 +31 -1 xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp
Index: SimpleXPathAPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SimpleXPathAPI.cpp 27 Nov 2002 23:48:47 -0000 1.10
+++ SimpleXPathAPI.cpp 13 Mar 2003 23:53:38 -0000 1.11
@@ -35,6 +35,36 @@
+XALAN_USING_XALAN(XalanNode)
+XALAN_USING_XALAN(XalanElement)
+
+
+
+const XalanElement*
+getPrefixResolver(const XalanNode* node)
+{
+ if (node == 0)
+ {
+ return 0;
+ }
+ else if (node->getNodeType() == XalanNode::ELEMENT_NODE)
+ {
+ return static_cast<const XalanElement*>(node);
+ }
+ else if (node->getNodeType() == XalanNode::DOCUMENT_NODE)
+ {
+ XALAN_USING_XALAN(XalanDocument)
+
+ return static_cast<const XalanDocument*>(node)->getDocumentElement();
+ }
+ else
+ {
+ return getPrefixResolver(node->getParentNode());
+ }
+}
+
+
+
int
main(
int argc,
@@ -124,7 +154,7 @@
theDOMSupport,
theContextNode,
XalanDOMString(argv[3]).c_str(),
-
theDocument->getDocumentElement()));
+
getPrefixResolver(theContextNode)));
assert(theResult.null() == false);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]