XPath syntax to extract URL from HTMLNode using HTMLAgilityPack?
What is the proper XPath syntax to grab the value of the href attribute from the following HTMLNode:
<开发者_JAVA百科;a target="_blank" class="monkeys" href="http://someurl.com" id="123">
<span class="title">Monkeys are flying all over!</span>
</a>
//a[@id='123']/@href
works for me.
Is //a@href
what you're looking for?
Using HTMLAgilityPack, the method you'd use is:
HTMLAgilityPack.HTMLNode.GetAttributeValue("href", "")
精彩评论