Java jsup line feed problem
•
Java
I want this code;
<p>Text<br /> New Text<br /> Second Text<br /> Third Text</p>
With this code;
Elements pResult = p.getElementsByTag("p"); System.out.println(pResult.text());
I showed this > text, new text, second text, third text
But I want to
<p>Text <br>New text<br>Second Text<br>Third Text</p>
Because < br > label
Solution
Try this Code:
String s="<p>Text<br />\nNew Text<br />\nSecond Text<br />\nThird Text</p>"; System.out.println(Jsoup.parse(s).select("p").outerHtml());
OUTPUT
<p>Text<br> New Text<br> Second Text<br> Third Text</p>
Jsoup 1.8. three
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码