Reputation: 781
I have a Xml file, ( actually HTML tags ) , I want to use the SelectNodes method to get ANY node/tag containing a keyword. The node name can be anything <td> , <div> <p>
. What is the XPath to get any node which contains a keyword?
Upvotes: 0
Views: 1158
Reputation:
This XPath expression:
/html/body//*[text()[contains(.,'keyword')]]
This means: any element descendant of body
having a text node child with the string 'keyword' contained in its string value.
Edit: Better predicate 'cause probably there is more than one text node child...
Upvotes: 4