Pregunta

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 hay solución correcta

Otros consejos

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top