Domanda

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

Nessuna soluzione corretta

Altri suggerimenti

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top