Java 使用JSoup获取特定(预格式化)文本(来自网站)

Java 使用JSoup获取特定(预格式化)文本(来自网站),java,html,web,jsoup,Java,Html,Web,Jsoup,我是JSoup的新手,我想用这个特定的HTML标记编写文本: <pre class="cg-msgbody cg-view-msgbody"><span class="cg-msgspan"><span>**the text I want to get is present here, how can I get it using JSoup?**</span></span></pre> **我想获取的文本在这里,如何使用

我是JSoup的新手,我想用这个特定的HTML标记编写文本:

<pre class="cg-msgbody cg-view-msgbody"><span class="cg-msgspan"><span>**the text I want to get is present here, how can I get it using JSoup?**</span></span></pre>
**我想获取的文本在这里,如何使用JSoup获取**
任何帮助都将不胜感激

谢谢

String html=“”
String html = "<pre class=\"cg-msgbody cg-view-msgbody\">"
       + "<span class=\"cg-msgspan\">"
       + "<span>**the text I want to get is present here, "
       + "how can I get it using JSoup?**</span>"
       + "</span>"
       + "</pre>";
    org.jsoup.nodes.Document document = Jsoup.parse(html);

    //a with href
    Element link = document.select("span").last();

    System.out.println("Text: " + link.text());
+ "" +“**我要获取的文本存在于此处,” +“如何使用JSoup获取它?**” + "" + ""; org.jsoup.nodes.Document Document=jsoup.parse(html); //a带href 元素链接=文档。选择(“span”).last(); System.out.println(“Text:+link.Text());
您可以使用css选择器
.cg-msgbody.cg-view-msgbody>.cg-msgspan
请发布您到目前为止完成的代码?