Home > Blockchain >  XPath to select element
XPath to select element

Time:07-02

<?xml version="1.0" encoding="UTF-8"?>
<a>
   <b>6.89<c>45</c></b>
</a>

I tried //b getting wrong result http://xpather.com/LwG6si6t

Desired Output to get 6.89 only.

Thanks!

CodePudding user response:

You want //b/text() for that sample or //b/text()[1] if there can be more text after the c element.

  • Related