3
我想添加一个<div class="wrapper">
我身体标记后生成的HTML。我想结束</div>
在结束</body>
之前。到目前为止,我有JSoup添加包装div后身体
private String addWrapper(String html) {
Document doc = Jsoup.parse(html);
Element e = doc.select("body").first().appendElement("div");
e.attr("class", "wrapper");
return doc.toString();
}
和我得到
</head>
<body>
</head>
<p>Heyo</p>
<div class="wrapper"></div>
</body>
</html>
我也想不通为什么我的HTML越来越“< /头>”了。我只有在使用JSoup时才能得到它。
这工作!谢谢!! – CodeMinion