[英]How do I use Jsoup to parse html for text?
如何使用Jsoup解析库解析html文件,以使Tag与空白具有相同的效果?
例如
如果我使用Jsoup解析函数解析以下字符串
word<br>one<br>is<br>one<br>word
我应该得到
word one is one word
而不是
wordoneisoneword
请看这里:
final String html = "word<br>one<br>is<br>one<br>word";
Document doc = Jsoup.parse(html);
String output = doc.text();
System.out.println(output);
输出:
word one is one word
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.