How do I use the Jsoup parsing library to parse html files such that Tags should have the same effect as whitespace?

for eg.

If I parse the below string using Jsoup parse function

word<br>one<br>is<br>one<br>word

I should get

word one is one word

rather than

wordoneisoneword

没有正确的解决方案

其他提示

Please see here:

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);

Output:

word one is one word
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top