I need to find a(only one) XML node which is having non-empty data. How to do this.
XML:
<root>
<tuple >
<old>
<a>
<b></b>
</a>
</old>
</tuple>
<tuple >
<old>
<a>
<b>http://google.com</b>
</a>
</old>
</tuple>
<tuple >
<old>
<a>
<b>http://google.com</b>
</a>
</old>
</tuple>
</root>
XPATH I used:
/root/tuple/old/a/b[text() and not(//a/b/text())]
and
/root/tuple/old/a/b[string-length(text())>0]/text()
But for the above xpath expressions I am getting all the nodes which are non-empty, What I am doing wrong.
bare non-empty because they contain whitespace text nodes (the new lines and indentation).