XML Schema 参考手册 完整 XML Schema 参考手册 The element specifies that child elements can appear in any order, and each child element can appear zero or once. 父元素: Group, complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent) (? The symbol declares that the element can appear zero or once, while the* symbol declares that the element can appear zero or more times in all elements. ) Attribute Description Id Optional. Unique identifier of the element. MaxOccurs Optional. The maximum number of times an element can appear. The value must be 1. MinOccurs Optional. The minimum number of times an element can appear. The value can be an integer 0 or 1. To specify that the element is optional, set the property to 0. The default value is 1. Any attributes Optional. Specifies any other attributes with the non-schema namespace. The above example indicates that “firstname” and “lastname” elements can appear in any order, and both elements must and can only appear once! The above example indicates that “firstname” and “lastname” elements can appear in any order, and each element can appear zero or once!Definition and usage ¶
Element information ¶
Grammar ¶
<all
id=ID
maxOccurs=1
minOccurs=0|1
*any attributes*
>
(annotation?,element*)
</all>
Example 1 ¶
<xs:element name="person">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
Example 2 ¶
<xs:element name="person">
<xs:complexType>
<xs:all minOccurs="0">
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>