我有这个HTML
<td rowspan="3" class="event start"> <a href="/search/1065650;1/note">INFO1<br>DETAIL1 DETAIL2<br>INFO2</a> </td>
如何使用jsoup获取INFO1和INFO2?
答案 0 :(得分:0)
尝试类似的东西:
Document doc = Jsoup.connect(url).get();
Elements td=doc.select("td.event.start");
Elements a = td.first().getElementsByTag("a");
String [] words = a.text().split(" ");
System.out.println(words[0]+" "+words[3]);
经过测试:
<!doctype html>
<html>
<body>
<td rowspan="3" class="event start">
<a href="/search/1065650;1/note">
INFO1<br>DETAIL1 DETAIL2<br>INFO2
</a>
</td>
</body>
</html>
&#13;