我有一个 html 字符串,看起来像这样:
<body>
I am a text that needs to be wrapped in a div!
<div class=...>
...
</div>
...
I am more text that needs to be wrapped in a div!
...
</body>
Run Code Online (Sandbox Code Playgroud)
所以我需要将悬挂的 html 文本包装在它自己的 div 中,或者将整个正文(文本和其他 div)包装在顶级 div 中。有没有办法用 JSoup 来做到这一点?非常感谢!
我正在使用 swiftsoup 库,因为有 Document 类,我用它来解析 html 文档。但是在我的团队中,我的一位朋友为不同的目的创建了 Document 类。现在,在接受他的 pull 后,我的代码发生了冲突。有没有办法同时使用这两个类?。错误是“无法将‘文档’类型的值转换为指定类型的‘文档’”提前致谢