XML EXMAPLE:
<first node>
<second node>
hello
</second node>
<third node>
abcd
</third node>
</first node>
If the Xml file looks like above and I give an input path "first node/second node", I must be able to get the result as "hello".
If the input path is "first node/third node", the result should be "abcd"
You have invalid XML: tag names cannot contain spaces and end tags are written like
</tag>
, not<tag/>
.Here, I fixed XML for you:
Now to get
second-node
andthird-node
contents you need proper XPath expression, e.g.//first-node/second-node/text()
and//first-node/third-node/text()
.Here is complete example: