开发者

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", "")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜