I want to get 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 show this > Text New Text Second Text Third Text
But i want
<p>Text <br>New text<br>Second Text<br>Third Text</p>
Because of <br>
tag
tag, without tags. I think what you need to do is to use .html() function: pResult.html(), then replace all
– Tornike Shavishvili Apr 08 '16 at 11:31inside your string with newline character and print it. (or you could just split string on
and print afterwards)
", "\n"))`. – SubOptimal Apr 08 '16 at 11:39
Text
" <--this, you use following: pResult.outerHtml() – Tornike Shavishvili Apr 08 '16 at 13:50New text
Second Text
Third Text