I'm still a little unclear on how XPath and namespaces relate.
I'm working on a program which can take as input 2 things: any arbitrary
xxml document, and any arbitrary xpath expression. I need to run the
expression on the document. My initial guess is that this code will do the
trick:
XPath xpath =
(XPath)DocumentHelper.createXPath(expression);
Node selectedNode =
(Node)xpath.selectSingleNode(document);
I *think* this should work for every case (assuming the xpath is correctly
entered by the user), but this code doesn't take namespaces into account. I
remember having to jump through some hoops for another part of my code which
does use namespaces, and I also seem to remember some function which adds
all the namespaces of a document to the xpath object. Am I mistaken here?
What is the correct way to go?
-David-<<attachment: winmail.dat>>
