是否可以有多个父节点?
例子:
<?xml version="1.0" encoding="UTF-8" ?>
<parentOne>
<child>
<subChild></subChild>
</child>
</parentOne>
<parentTwo>
<child>
<subChild></subChild>
</child>
</parentTwo>
有没有办法完成这项工作?
最佳答案
简短的回答:没有。
每个 XML 文档都有 exactly one root element 和 standard 一样。
使用类似这样的东西:
<?xml version="1.0" encoding="UTF-8" ?>
<parents>
<parent id="One">
<child>
<subChild></subChild>
</child>
</parent>
<parent id="Two">
<child>
<subChild></subChild>
</child>
</parent>
</parents>
关于xml - XML 文档可以有多少个父节点?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8909580/