Question

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

No correct solution

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top