Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个问题:
在这段代码 html 中:
<li> <b> text1 </b> "text2" </li>
使用 jsoup 我设法获取标签“li”的文本,但我得到的是“text1”和“text2”,我该如何只取“text2”?
ownText()Element类的方法呢?
ownText()
String html = "<li><b> text1 </b> \"text2\" </li>"; Document doc = Jsoup.parse(html); System.out.println(doc.select("li").first().ownText());
将输出:
"text2"