XML 스키마 선택 요소
❮ 완전한 XML 스키마 참조
정의 및 사용
XML 스키마 선택 요소는 <choice> 선언에 포함된 요소 중 하나만 포함하는 요소 내에 존재하도록 허용합니다.
요소 정보
- 상위 요소: 그룹, 선택, 시퀀스, complexType, 제한(simpleContent 및 complexContent 모두), 확장(simpleContent 및 complexContent 모두)
통사론
<choice
id=ID
maxOccurs=nonNegativeInteger|unbounded
minOccurs=nonNegativeInteger
any attributes
>
(annotation?,(element|group|choice|sequence|any)*)
</choice>
(? 기호는 요소가 0번 또는 1번 발생할 수 있음을 선언하고 * 기호는 요소가 선택 요소 내에서 0번 이상 발생할 수 있음을 선언합니다)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
maxOccurs | Optional. Specifies the maximum number of times the choice 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 choice element can occur in the parent the element. The value can be any number >= 0. Default value is 1 |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
예시
<xs:element name="person">
<xs:complexType>
<xs:choice>
<xs:element name="employee" type="employee"/>
<xs:element name="member" type="member"/>
</xs:choice>
</xs:complexType>
</xs:element>
위의 예는 "직원" 요소 또는 "구성원" 요소를 포함해야 하는 "사람"이라는 요소를 정의합니다.
❮ 완전한 XML 스키마 참조