我有一个问题,我不能正确使用HTTP AGILITY包PACK,例如,想检索“样式”中包含的图像的地址,我想知道是否有人建议我使用xpath。
代码 HTML
<TABLE id=uezszu_24 class="uiGrid fbPhotosGrid" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class="vTop">
<DIV class=Wrapper>
<A class="uiMediaThumb uiScrollableThumb uiMediaThumbHuge" href="www.cccc.com/index.php"
name=43563463 rel=theater aria-label="photo" ajaxify="dsgdgbdfgr45y6ghd">
<I style="BACKGROUND-IMAGE: url(http://www.fressdgf.com/image.jpg)"></I>
</A>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
代码 VB
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim site As HtmlAgilityPack.HtmlWeb = New HtmlWeb()
Dim document As HtmlAgilityPack.HtmlDocument = site.Load("https://www.site.com")
For Each table As HtmlNode In document.DocumentNode.SelectNodes("//tr")
ListBox1.Items.Add(table.InnerText)
Next
End Sub
编辑:代码缩进改进