XPATH query for a node based on its value

Found the article Locating the node by value containing whitespaces using XPath on Stack Overflow – reprinted here so I don’t forget it:

If you know the exact value of the node – say it’s “Hello World” with a space used jumpers for sale:

   <aChild>Hello World</aChild>

Then the XPath expression:

/top/aChild[.='Hello World']

will select this node.

Leave a Reply

Your email address will not be published. Required fields are marked *