Red Hat Training

A Red Hat training course is available for Red Hat Fuse

2.5.5. 열거된 유형 정의

2.5.5.1. 개요

XML 스키마의 열거된 형식은 제한에 따라 정의의 특별한 사례입니다. 이러한 항목은 모든 XML 스키마 기본 형식에서 지원하는 열거 facet를 사용하여 설명합니다. 대부분의 최신 프로그래밍 언어에서 열거된 형식과 마찬가지로, 이 유형의 변수는 지정된 값 중 하나만 가질 수 있습니다.

2.5.5.2. XML 스키마에서 열거형 정의

열거형 정의의 구문은 예 2.16. “열거형 구문” 에 표시되어 있습니다.

예 2.16. 열거형 구문

<simpleType name="EnumName">
  <restriction base="EnumType">
    <enumeration value="Case1Value"/>
    <enumeration value="Case2Value"/>
    ...
    <enumeration value="CaseNValue"/>
  </restriction>
</simpleType>

열거형 형식의 이름 을 지정합니다.Specifies the name of the enumeration type. EnumType 은 case 값의 형식을 지정합니다. caseNValue . 여기서 N 은 열거의 각 특정 사례에 대한 값을 지정합니다. CaseNValue, where N is any number one or greater, specifies the value for each specific case of the enumeration. 열거된 형식은 임의의 수의 대/소문자 값을 가질 수 있지만 간단한 형식에서 파생되기 때문에 한 번에 하나의 케이스 값만 유효합니다.An enumerated type can have any number of case values, but because it is derived from a simple type, only one of the case values is valid at a time.

2.5.5.3. 예제

예를 들어 예 2.17. “widgetSize enumeration” 에 표시된 열거형 위젯Size에 정의된 요소가 포함된 XML 문서는 <wid getSize >big>big <widgetSize>가 포함된 경우 유효하지만 <widgetSize>big,mungo</widgetSize>가 포함된 경우 유효하지 않습니다.

예 2.17. widgetSize enumeration

<simpleType name="widgetSize">
  <restriction base="xsd:string">
    <enumeration value="big"/>
    <enumeration value="large"/>
    <enumeration value="mungo"/>
  </restriction>
</simpleType>