【发布时间】:2011-11-09 02:08:56
【问题描述】:
我正在使用 jsoup 1.6.1 并在尝试从 html 中删除 iframe 标记时遇到问题。当 iframe 没有任何正文时(即 ),remove() 方法会删除 t 标记后的所有内容。这是我的示例代码。
String html ="<p> This is start.</p><iframe frameborder="0" marginheight="0" /><p> This is end</p>";
Document doc = Jsoup.parse(html,"UTF-8");<br>
doc.select("iframe").remove();<br>
System.out.println(doc.text());
它回到我身边 -
This is start.
但我期待结果 -
This is start. This is end
提前致谢
【问题讨论】: