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

后端 未结 5 954
抹茶落季
抹茶落季 2020-12-03 11:49

Been looking at a tutorial and it has the following xml and xsd.:

\"http://yfrog.com/b9xsdandxmlj\"

Wha

5条回答
  •  伪装坚强ぢ
    2020-12-03 12:42

    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.

提交回复
热议问题