Jsoup选择标签后的文字

Min*_*ntz 11 java jsoup

我想使用jsoup在每个标签后提取一个文本.有没有办法直接选择它,还是我必须在整个事情上执行.substring?

<div>
<a href="#"> I don't want this text </a> 
**I want to retrieve this text**
</div>
Run Code Online (Sandbox Code Playgroud)

Vit*_*aly 28

public static void main(String... args) throws IOException {

    Document document = Jsoup.parse("<div>"
            + "<a href=\"#\"> I don't want this text </a>"
            + "**I want to retrieve this text**" + "</div>");

    Element a = document.select("a").first();

    Node node = a.nextSibling();
    System.out.println(node.toString());
}
Run Code Online (Sandbox Code Playgroud)

产量

**I want to retrieve this text**
Run Code Online (Sandbox Code Playgroud)