XMLスキーマシーケンス要素
❮完全なXMLスキーマリファレンス
定義と使用法
sequence要素は、子要素がシーケンスに表示される必要があることを指定します。各子要素は、0から任意の回数まで発生する可能性があります。
要素情報
- 親要素: group、choice、sequence、complexType、restriction(simpleContentとcomplexContentの両方)、extension(simpleContentとcomplexContentの両方)
構文
<sequence
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>
(annotation?,(element|group|choice|sequence|any)*)
</sequence>
(?記号は、要素がシーケンス要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
maxOccurs | Optional. Specifies the maximum number of times the sequence element can occur in the parent element. The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded". Default value is 1 |
minOccurs | Optional. Specifies the minimum number of times the sequence element can occur in the parent element. The value can be any number >= 0. Default value is 1 |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例1
この例は、「personinfo」という要素の宣言を示しています。この要素には、次の5つの要素が順番に含まれている必要があります。"firstname"、 "lastname"、 "address"、 "city"、および "country":
<xs:element name="personinfo">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
例2
この例は、シーケンス要素に次の要素(dogとcat)を0個以上含めることができる「pets」という要素の宣言を示しています。
<xs:element name="pets">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="dog" type="xs:string"/>
<xs:element name="cat" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
❮完全なXMLスキーマリファレンス