Mazdak
Mazdak

Reputation: 781

Search with XPath in VB.NEt

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

Answers (1)

user357812
user357812

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

Related Questions