[EMAIL PROTECTED] wrote:
Hello,
I am relatively new to Xalan and somehow it drives me mad. I need to
apply an xPath to the pre-parsed XML document. The document is a Xerces
DOMDocument instance.
I read some postings on how to do that, but none of them worked. I will
try to summerize my efforts below:
I saw a post from Joerg Seidler:
http://marc.theaimsgroup.com/?l=xalan-c-users&m=108385669500218&w=2
and tried to do it in similar way, but with no luck.
My system configuration is:
Xerces-C 2.7.0
Xalan-C 1.10
May be I forgot some initialization or anything else. Below are my
explanations:
1. Assume that Xerces-C and XPathEvaluator initializations succeeded.
And I have successfully parsed an XML document and have a DOMDocument
instance pointer to which I need xPath to be applied. xPath expression
was successfully tested for this document with XMLSpy and Oxygen XML
Editors (internally uses Xerces-J and Xalan-J). And the selection always
delivered the desired node. I extensively use namespaces in my document
and have my own namespace defined as default namespace. I know that
xPath 1.0 does not support default namespaces that's why I also write a
prefiexed xPath to the desired element.
My code looks as follows:
...
Using command line sample SimpleXPathAPI with the sampe xml document and
xPath returns a valid node.
Can someone point me to what is wrong?
It's hard to say without seeing some actual data. Can you post a small
sample document with namespaces, and the XPath expression you're using?
You might also try just modifying the SimpleXPathAPI samples program to
use the XercesDOMSupport and XercesParserLiaison classes, instead of
writing your own code. That might help determine if the problem is in
your code, your input data, or a bug in Xalan-C++.