XML Schema list 요소

정의와 사용법

list 요소는 단일 simpleType 정의의 집합을 정의합니다。

이 속성은 간단한 타입을 지정된 데이터 타입의 값의 목록으로 정의합니다。

요소 정보

출현 횟수 한 번
부모 요소 simpleType
내용 annotation, simpleType

문법

<list
id=ID 
itemType=QName 
any attributes
>
(annotation?,(simpleType?))
</list>

(? 기호는 list 요소 내에서 요소가 나타날 수 있는 횟수를 나타냅니다。)

속성 설명
id 선택 사항입니다. 이 요소의 독특한 ID를 지정합니다。
itemType 이 schema(또는 지정된 이름 공간에 의해 지시된 다른 schema)에서 정의된 내장 데이터 타입이나 simpleType 요소의 이름입니다. list 요소를 포함한 simpleType 요소는 list 값으로 지정된 간단한 타입에서 파생됩니다. list 값은 제한된 이름(QName)이어야 합니다. 내용이 simpleType 요소를 포함하면 이 속성을 사용할 수 없으며, 그렇지 않으면 이 속성은 필수입니다。
any attributes 선택 사항입니다. non-schema 이름 공간을 가진 다른 어떤 속성도 지정할 수 있습니다。

예제

예제 1

아래의 예제는 열의 간단한 정수 타입을 보여줍니다:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="intvalues" type="valuelist">
<xs:simpleType name="valuelist">
  <xs:list itemType="xs:integer"/>
</xs:simpleType>
</xs:schema>

문서에서 "intvalues" 요소는 다음과 같습니다. (이 목록에는 다섯 개의 목록 항목이 있습니다):

<intvalues>100 34 56 -23 1567</intvalues>

주의사항:공백은 목록 항목의 구분자로 사용됩니다。

예제 2

아래의 예제는 문자열 열의 간단한 타입을 보여줍니다:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="stringvalues" type="valuelist">
<xs:simpleType name="valuelist">
  <xs:list itemType="xs:string"/>
</xs:simpleType>
</xs:schema>

문서의 "stringvalues" 요소는 이렇게 보입니다(이 목록에는 네 가지 목록 항목이 있습니다):

<stringvalues>XML Schema를 사랑합니다</stringvalues>