【发布时间】:2012-10-24 12:40:14
【问题描述】:
JSoup 似乎在我的输出中添加了额外的 br 标记,如下所示。有没有办法阻止这种情况发生?
JUnit 测试:
@Test
public void testJsoup () throws MLException {
String htmlBody = "<body> <div> <br class='calibre1'></br> <br class='calibre1'></br></div> </body>";
Document doc = Jsoup.parse(htmlBody);
htmlBody = doc.select("body").first().toString();
System.out.println(htmlBody);
}
控制台输出:
<body>
<div>
<br class="calibre1" />
<br />
<br class="calibre1" />
<br />
</div>
</body>
问候, 丹尼
【问题讨论】:
标签: jsoup