开发者

Xpath preceding-sibling (using HtmlAgilityPack and VB)

开发者 https://www.devze.com 2023-01-15 16:03 出处:网络
Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents. I need help selecting the preceding-sibling of div class=\"address\" in this url:

Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents.

I need help selecting the preceding-sibling of div class="address" in this url: www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON The sibling that I want is h3 class="listingTitleLine"

Here is a screenshot:

http://i55.tinypic.com/25gc4qo.png C开发者_JAVA技巧an I get some help please.

-Dd,


To select the preceding-sibling H3 element with the class attribute value of "listingTitleLine":

preceding-sibling::h3[@class='listingTitleLine']

To select each of the H3 elements with a class attribute value of "linstingTitleLine" that are preceding-siblings of div elements with a class attribute value of "address":

//div[@class='address']/preceding-sibling::h3[@class='listingTitleLine']
0

精彩评论

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