通过了解前一个元素,可以使用jSoup获得继续元素吗?jsoup抓取元素处理特定元素
例如,在这个网站,我有表的“鉴于这一项目”数据
我想获得一个包含邻桌“寻找这个”
<table><tr><td>irrelevant info 1 <a href="http://jsoup.org/">jsoup</a></td></tr></table>
<p>there is a p here</p>
<table><tr><td>Given this item <a href="http://jsoup.org/">jsoup</a></td></tr></table>
<p>there is a p here</p>
<table><tr><td>Looking for this <a href="http://jsoup.org/">jsoup</a></td></tr></table>
<p>there is a p here</p>
<table><tr><td>irrelevant info 2<a href="http://jsoup.org/">jsoup</a></td></tr></table>
<p>there is a p here</p>
<table><tr><td>irrelevant info 3 <a href="http://jsoup.org/">jsoup</a></td></tr></table>
例如: http://try.jsoup.org/~vtmUE0bVgNHSxdvpKcIzpL3pHEA
这很奇怪 - 我我试过使用'〜'但出于某种原因,我没有得到预期的结果。 – TDG
请将此添加到您的解决方案 - 我会接受它。 – user648026
但它不适用于我,所以我使用了我的答案中描述的方法。你不需要接受我的答案。如果你的解决方案有效,你应该接受它,所以其他用户会知道它解决了你的问题。 – TDG