XMLスキーマユニオン要素
❮完全なXMLスキーマリファレンス
定義と使用法
union要素は、単純型を、指定された単純データ型からの値のコレクション(union)として定義します。
要素情報
- 親要素: simpleType
構文
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(?記号は、要素がunion要素内で0回または1回発生する可能性があることを宣言します)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
memberTypes | Optional. Specifies a list of built-in data types or simpleType elements defined in a schema |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
例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>
❮完全なXMLスキーマリファレンス