Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jsoup remove nested tags but keep text

I have html in a set of elements so there may be other items like this

<b><a title="San Francisco/Twin Peaks-Lake Merced">Twin Peaks</a></b>

but I would like to clean it up with jsoup like this

<b>Twin Peaks</b>

Would using a whitelist be the best idea?

like image 742
No_name Avatar asked Aug 22 '12 06:08

No_name


1 Answers

sorry for cluttering up stackoverflow, but unwrap solves the problem.

document.select("a").unwrap()
like image 150
No_name Avatar answered Oct 15 '22 22:10

No_name