Can you query from a non-root node using XPathAPI?

S

Scott Simpson

Can you query from a non-root node using XPathAPI's function
selectNodeList(Node contextNode, java.lang.String str)? I'm trying this
using the XPath expression "//*" and I'm getting nothing back. I know the
node I pass to this function has data in it because I'm inspecting it in the
debugger using Eclipse. The Javadoc doesn't say you can't query from a
non-root node. Thanks.
 
M

Martin Honnen

Scott said:
Can you query from a non-root node using XPathAPI's function
selectNodeList(Node contextNode, java.lang.String str)? I'm trying this
using the XPath expression "//*" and I'm getting nothing back. I know the
node I pass to this function has data in it because I'm inspecting it in the
debugger using Eclipse. The Javadoc doesn't say you can't query from a
non-root node. Thanks.

//* is an absolute path, it is never relative but always goes down from
the document root node to all element nodes in the document.
If you want a relative path you are probably looking for
.//*
which goes down from the context node to all element descendant nodes.
 
S

Scott Simpson

Thank you. That worked.

Martin Honnen said:
//* is an absolute path, it is never relative but always goes down from
the document root node to all element nodes in the document.
If you want a relative path you are probably looking for
.//*
which goes down from the context node to all element descendant nodes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top