1

我需要解析该表的项目并将其显示TextBox在 VB.NET 的各种控件中。

<table class="forumline" border="0" width="90%">
    <th colspan="3">Information about ipaddress 173.194.40.144</th>
<tr>
    <td width="15%" align="right" colspan="1" class="row3"valign="top"><p align="center"><b>Provider Info</b></td>
    <td width-"15%" align="center" colspan="1" class="row3">Country Info</td>
    <td width="15%" align="center" colspan="1" class="row3"><b>Time info</b></td>
</tr>
<tr>
    <td align="center" class="row1" width="15%">IP address<br><input type="text" name="T1" size="20" value="173.194.40.144"> </td>
    <td align="center" class="row1" width="15%">Country<br><input type="text" name="T2" size="20" value="United States"></td>
    <td align="center" class="row1" width="15%">Continent<br><input type="text" name="T3" size="20" value="North America"></td>
</tr>
<tr>
    <td align="center" class="row2" width="15%">Hostname<br><input type="text" name="T4" size="20" value="par10s10-in-f16.1e100.net"></td>
    <td align="center" class="row2" width="15%">Region (code)<br><input type="text" name="T8" size="20" value="California (CA)"></td>
    <td align="center" class="row2" width="15%">Latitude<br><input type="text" name="T12" size="20" value="37.4192"></td>
</tr>
<tr>
    <td align="center" class="row1" width="15%">Organization<br><input type="text" name="T5" size="20" value="Google"></td>
    <td align="center" class="row1" width="15%">City<br><input type="text" name="T9" size="20" value="Mountain View"></td>
    <td align="center" class="row1" width="15%">Longitude<br><input type="text" name="T13" size="20" value="-122.0574"></td>
</tr>
<tr>
    <td align="center" class="row2" width="15%">ISP<br><input type="text" name="T7" size="20" value="Google"></td>
    <td align="center" class="row2" width="15%">Areacode<br><input type="text" name="T10" size="20" value="650"></td>
    <td align="center" class="row2" width="15%">Time zone<br><input type="text" name="T14" size="20" value="America/Los_Angeles"></td>
</tr>
<tr>
    <td align="center" class="row1" width="15%">Flag<br><img src="flags/us.gif"></td>
    <td align="center" class="row1" width="15%">Postalcode<br><input type="text" name="T11" size="20" value="94043"></td>
    <td align="center" class="row1" width="15%">GMT offset<br><input type="text" name="T15" size="20" value="-7"></td>
</tr>

当用户单击按钮时,我得到数据(IP 地址、国家、大陆、... GMT 偏移量)。

我尝试使用 HtmlAgilityPack,但也许 XPATH 更好。当表没有id时,我不知道如何使用它。我想我必须为此使用tdname (ex name="T1") 但是如何?

Private Sub NsButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NsButton1.Click

    Dim url As String = ("http://www.iptrackeronline.com/index.php?ip_address=" & NsTextBox1.Text)
    Dim doc As New HtmlAgilityPack.HtmlDocument
    doc.LoadHtml(url)
    Dim node As HtmlAgilityPack.HtmlNode
4

0 回答 0