Why does XPath.selectNodes(context) always use the whole document in JDOM
Posted
by
Simeon
on Stack Overflow
See other posts from Stack Overflow
or by Simeon
Published on 2011-02-04T09:01:05Z
Indexed on
2011/02/04
15:25 UTC
Read the original article
Hit count: 311
Hi,
I'm trying to run the same query on several different contexts, but I always get the same result. This is an example xml:
<root>
<p>
<r>
<t>text</t>
</r>
</p>
<t>text2</t>
</root>
So this is what I'm doing:
final XPath xpath = XPath.newInstance("//t");
List<Element> result = xpath.selectNodes(thisIsThePelement);
// and I've debuged it, it really is the <p> element
And I always get both <t>
elements in the result list.
I need just the <t>
inside the <p>
I'm passing to the XPath
object.
Any ideas would be of great help, thanks.
© Stack Overflow or respective owner