XML 스키마 시퀀스 요소
❮ 완전한 XML 스키마 참조
정의 및 사용
sequence 요소는 자식 요소가 시퀀스에 나타나야 함을 지정합니다. 각 자식 요소는 0에서 여러 번 나타날 수 있습니다.
요소 정보
- 상위 요소: 그룹, 선택, 시퀀스, complexType, 제한(simpleContent 및 complexContent 모두), 확장(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
이 예는 다음 5가지 요소를 순서대로 포함해야 하는 "personinfo"라는 요소에 대한 선언을 보여줍니다. "이름", "성", "주소", "시" 및 "국가":
<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 스키마 참조