JSoup select 个数字

JSoup select numbers

<div class="sResMain">
    <b>
        <a href="/dogukan1905?&amp;from=search&amp;qs=age1%3D16%26age2%3D27%26sex%255B0%255D%3DMALE%26sex%255B1%255D%3DFEMALE%26region%3D%26keywords%3D%26photo%3D1%26sort%3Dlast_login%26todo%3Dsearch%26offset%3D0" class="male">dogukan1905</a>
    </b>
    <img src="http://eu.ipstatic.net/images/male.gif" width="11" height="11" class="sResSex">
    20 
    <br>
<div class="sResMainTxt">
<div class="sResTxtField">I&nbsp; study at aircraft technology...</div></div></div>

我想在 imgbr 标签之间添加 select number(20) 个。然而我做不到。

根据您发布的内容,您尝试解析的文本属于 <div class="sResMain">。此外,这是 <div class="sResMain"> 唯一的文本。 Jsoup 中有一种方法可以 return 属于(直接文本节点子节点)节点的文本。尝试 ownText()Element

Document doc = Jsoup.parse(htmlStr);
Elements elements = doc.select(".sResMain");
for(Element e : elements) {
    String text = e.ownText();
    System.out.println(text);
}