Why does XPath.selectNodes(context) always use the whole document in JDOM
- by Simeon
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.