I am converting code from c# to java.
I have the following xml structure:
<Foo>
<Son>
<Id>xxx</Id>
</Son>
... more sons
</Foo>
I need to select nodes according to the Id value(can be more than one.
I have this line in c#:
XmlNodeList res=xmlDoc.SelectNodes("descendant::Son[Id='xxx']");
I tried to convert it to the following:
NodeList res=(NodeList)xPath.evaluate("xpath expr",inputSource,XPathConstants.NODESET);
However, I didn’t manage to write the right XPath expression.
Any help?
Thanks,
Sara
I’m not at my development machine, but having used XPath in the past, this pops into mind:
Also, it’s helpful in your question to mention what you’ve tried, and how the results differ from your target output.