XMLスキーマのすべての要素
❮完全なXMLスキーマリファレンス
定義と使用法
all要素は、子要素が任意の順序で表示できること、および各子要素が0回または1回出現できることを指定します。
要素情報
- 親要素: group、complexType、restriction(simpleContentとcomplexContentの両方)、extension(simpleContentとcomplexContentの両方)
構文
<all
id=ID
maxOccurs=1
minOccurs=0|1
any attributes
>
(annotation?,element*)
</all>
(?記号は、要素が0回または1回発生する可能性があることを宣言し、*記号は、要素がすべての要素内で0回以上発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
maxOccurs | Optional. Specifies the maximum number of times the element can occur. The value must be 1. |
minOccurs | Optional. Specifies the minimum number of times the element can occur. The value can be 0 or 1. Default value is 1 |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例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>
上記の例は、「firstname」要素と「lastname」要素は任意の順序で表示できることを示していますが、両方の要素は1回だけ出現する必要があります。
例2
<xs:element name="person">
<xs:complexType>
<xs:all>
<xs:element name="firstname" type="xs:string" minOccurs="0"/>
<xs:element name="lastname" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
上記の例は、「firstname」要素と「lastname」要素が任意の順序で表示され、各要素が0回または1回表示される可能性があることを示しています。
❮完全なXMLスキーマリファレンス