在 nokogiri 中解析多个没有 root 的标签
我想做这样的事情:
fragment = parse("<p></p> <p></p>")
another_node.add_child(fragment)
但到目前为止,我还没有找到任何可以完成这项工作的东西 - 所有东西都需要一个具有多个子节点的根节点。关于如何实现这一目标有什么想法吗?这个要求似乎并没有那么奇怪,我觉得我一定错过了一些东西。
I'm looking to do something like this:
fragment = parse("<p></p> <p></p>")
another_node.add_child(fragment)
But so far I haven't found anything that does the job - everything wants one root node with multiple children. Any ideas about how to accomplish this? It doesn't seem like it's that odd a request, and I feel like I must be missing something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有效:
This works: