Link to home
Create AccountLog in
Avatar of tuchfeld
tuchfeld

asked on

XPath - getting a child element that has a property value that CONTAINS some string

Hello,
Using XPath, I'd like to locate a child element that has a property value that Contains some string.
Example:
HtmlNode a = tr.SelectSingleNode(@".//a[@href='*SOMESUBSTRING*']");

Open in new window

should get this node:
<a href="/bla/SOMESUBSTRING/bla.html">

Open in new window

Is it possible?
Also if you have links for docs and example of such more complex XPath expressions.
Thanks, Aryeh.
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of tuchfeld
tuchfeld

ASKER

I just tried and it worked!
(BTW I use: HtmlAgilityPack library)
Thanks a lot!
again, if you have some good doc & Example links for such issues, please paste them here.
Just what I asked for. Thanks.
welcome

XPath on wikipedia reads as a tutorial
http://en.wikipedia.org/wiki/Xpath
this one seems OK too
http://edutechwiki.unige.ch/en/XPath_tutorial_-_basics#Introduction_to_XML_Path_Language
(ignore the XSLT syntax used sometimes)
don't go to w3schools because they are confusing and mix XPAth2 functions