所以我正在编写一个应用程序来做一点屏幕抓取。我正在使用HTML Agility Pack将整个 HTML 页面加载到HtmlDocoument
被调用的实例中doc
。现在我想解析那个文档,寻找这个:
<table border="0" cellspacing="3">
<tr><td>First rows stuff</td></tr>
<tr>
<td>
The data I want is in here <br />
and it's seperated by these annoying <br /> 's.
No id's, classes, or even a single <p> tag. </p> Just a bunch of <br /> tags.
</td>
</tr>
</table>
所以我只需要在第二行中获取数据。我怎样才能做到这一点?我应该使用正则表达式还是其他东西?
更新:这是我加载我的方式doc
HtmlWeb hw = new HtmlWeb();
HtmlDocument doc = hw.Load(Url);