XML Schema union要素
完全な XML Schema リファレンスマニュアル
定義と使用方法
union 要素は、複数の simpleType 定義の集まりを定義します。
要素情報
- 親要素: simpleType
構文
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(? 記号は、その要素が union 要素内に 0 回または 1 回出現できることを宣言します。)
| 属性 | 説明 |
|---|---|
| id | 任意。この要素の一意の ID を指定します。 |
| memberTypes | 任意。スキーマ内で定義された組み込みデータ型または simpleType 要素の名前のリストを指定します。 |
| any attributes | 任意。non-schema 名前空間を持つその他の属性を指定します。 |
例 1
この例は、2 つの単純型を結合した単純型です:
<xs:element name="jeans_size">
<xs:simpleType>
<xs:union memberTypes="sizebyno sizebystring" />
</xs:simpleType>
</xs:element>
<xs:simpleType name="sizebyno">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="42"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="sizebystring">
<xs:restriction base="xs:string">
<xs:enumeration value="small"/>
<xs:enumeration value="medium"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:union memberTypes="sizebyno sizebystring" />
</xs:simpleType>
</xs:element>
<xs:simpleType name="sizebyno">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="42"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="sizebystring">
<xs:restriction base="xs:string">
<xs:enumeration value="small"/>
<xs:enumeration value="medium"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>
完全な XML Schema リファレンスマニュアル その他の拡張