<tr valign="middle" align="center">
<td><b>someNumbers</b></td>
<td width="22" height="22" background="..." class="SomeIntrestingClass">xxxxx</td>
<td width="22" height="22" background="..." class="SomeIntrestingClass">xgdsx</td>
<td width="22" height="22" background="..." class="SomeIntrestingClass">xyzzx</td>
<td width="22"> </td></tr>
我正在制作一个需要网站数据的应用程序。我需要提取'someNumbers'中的值和td ex中的值:'xyzzx'...
我遇到的问题是'someNumbers没有类,所以我尝试使用
doc.getElementsByAttributeValue(key, value)
但是文档的其他部分中的属性是相同的。如何使用JSoup或任何其他明智的想法提取这些值?谢谢你的任何建议。
答案 0 :(得分:0)
Document.select(...);
此方法的作用是什么,我们可以使用{css选择器',例如td.class
或tr td #id
,只需使用它们,就好像它们是article中的css选择器一样在Jsoup。
答案 1 :(得分:-1)
<td[^<]+?>*</[^<]+?>
将此作为正则表达式并将其全部存储在数组中
然后删除<td[^<]+?>
,然后删除</[^<]+?>
。