Reputation: 4359
Is it possible to have more than one set of parent nodes?
example:
<?xml version="1.0" encoding="UTF-8" ?>
<parentOne>
<child>
<subChild></subChild>
</child>
</parentOne>
<parentTwo>
<child>
<subChild></subChild>
</child>
</parentTwo>
is there a way for that work?
Upvotes: 3
Views: 1740
Reputation: 336378
Short answer: No.
Every XML document has exactly one root element as per standard.
[Definition: There is exactly one element, called the root, or document element, no part of which appears in the content of any other element.] For all other elements, if the start-tag is in the content of another element, the end-tag is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other.
Use something like this instead:
<?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>
Upvotes: 9
Reputation: 1768
No, there can only be one parent node (if by that, you mean, having multiple , etc). I would have root node of something like , then etc.
Hope this helps.
Upvotes: 0