I am using jsoup and it is really nice to tidy up some html, but I have a piece of invalid html as following:
<p>The recurrence, in close succession <ul><li>list item 1</li><li>list item 2</li></ul> second part of thisssss
What I want to get is :
<p>The recurrence, in close succession </p><ul><li>list item 1</li><li>list item 2</li></ul> <p>second part of thisssss</p>
So is the jsoup capable of tidying up the html and return this output ?
thanks
Yes, try this:
String html = "<p>The recurrence, in close succession <ul><li>list item 1</li><li>list item 2</li></ul> second part of thisssss";
String clean = Jsoup.clean(html, Whitelist.relaxed());
You can use another Whitelist as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With