XML Schema: root element

前端 未结 6 1224
难免孤独
难免孤独 2020-12-03 04:11

The following post asks how to indicate that an element is the root element in an XML schema:

Is it possible to define a root element in an XML Document using Schema

6条回答
  •  再見小時候
    2020-12-03 04:41

    As far as I know, any globally defined element can be used as root element, and XML Schema does not have a notion for specifying what the root element is supposed to be.

    You can however work around this by designing your XML Schema well, so that there is only one globally defined element - then only this element is valid as root element.

    An example of this can be found at W3Schools (heading Using Named Types) This example only has one globally defined element, and thus only one possible root element.

提交回复
热议问题