简体   繁体   English

Jsoup删除嵌套标签但保留文本

[英]Jsoup remove nested tags but keep text

I have html in a set of elements so there may be other items like this 我在一组元素中有html,所以可能还有其他类似的项目

<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 但是我想用这样的jsoup来清理它

<b>Twin Peaks</b>

Would using a whitelist be the best idea? 使用白名单是最好的主意吗?

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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