Do you always have to have a root node with xml/xsd?

from the XML specification at http://www.w3.org/TR/REC-xml/ (fifth edition) chapter 2

This says

“Each XML document has both a logical and a physical structure. Physically, the document is composed of units called entities. An entity may refer to other entities to cause their inclusion in the document. A document begins in a “root” or document entity.”

“[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.”

So basically yes, you always need one root element.

Leave a Comment