선택한 그룹에 들어 있는 요소 중 한 개만 포함하는 요소 내에 존재하도록 허용합니다.
<choice
id = ID
maxOccurs= (nonNegativeInteger | unbounded) : 1
minOccurs= nonNegativeInteger : 1
{any attributes with non-schema Namespace}...>
Content: (annotation?, (element | group | choice | sequence | any)*)
</choice>
특성
id
이 요소의 ID입니다. id 값은 ID 형식이어야 하며 이 요소를 포함하는 문서 내에서 고유한 값이어야 합니다.선택적 항목입니다.
maxOccurs
선택이 발생할 수 있는 최대 횟수입니다. 값은 0보다 크거나 같은 정수일 수 있습니다. 최대 횟수를 제한하지 않으려면 문자열 "unbounded"를 사용합니다. 기본값은 1입니다.선택적 항목입니다.
minOccurs
선택이 발생할 수 있는 최소 횟수입니다. 값은 0보다 크거나 같은 정수일 수 있습니다. 선택 그룹을 선택적 요소로 지정하려면 이 특성을 0으로 설정합니다. 기본값은 1입니다.선택적 항목입니다.
요소 정보
발생 횟수 |
group 및 complexType 요소 내에서는 한 번 발생하며 그 외의 경우에는 제한이 없습니다. |
부모 요소 |
group, choice, sequence, complexType, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent) |
내용 |
annotation, any, choice, element, group, sequence |
예제
다음 복합 형식은 지정된 네 개 요소 중 단 한 개 요소만 선택하고 하나의 특성을 가진 요소를 정의합니다.
<xs:complexType name="chadState">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element ref="selected"/>
<xs:element ref="unselected"/>
<xs:element ref="dimpled"/>
<xs:element ref="perforated"/>
</xs:choice>
<xs:attribute name="candidate" type="candidateType"/>
</xs:complexType>
관련 자료
자세한 내용은 www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-all에 있는 Structures Recommendation을 참조하십시오.