简体   繁体   中英

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?

抱歉混乱堆栈溢出,但解包解决了问题。

document.select("a").unwrap()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM