jsoup to strip only html tags not new line character?
I have below content in Java where I want to strip only html tags but not new line characters <p>test1 <b>test2</b> test 3 </p> //line 1 <p>test4 </p> //line 2 If I open above content in text rich editor, line 1 and line 2 are displayed in different lines(without showing </p> tag).But in notepad content is shown along with </p> tags. To remove all html tags I used Jsoup.parse(aboveContent).text() It removes all html characters. But it shows all line 1 and line 2 in same line in notepad. Somehow Jsoup also removes newline character. What I tried:- I also tried replacing </p> with \r\n and then