XMLスキーマunion要素

定義と用法

union要素は複数のsimpleType定義の集合を定義します。

要素情報

出現回数 一度
親要素 simpleType
内容 annotation、simpleType

文法

<union
id=ID
memberTypes="list of QNames"
任意の属性
>
(annotation?,(simpleType*))
</union>

(?シンボルはunion要素内で、この要素は0回または1回出現できます。)

属性 説明
id オプション。この要素のユニークなIDを指定します。
memberTypes オプション。スキーマで定義されたインバウンドデータタイプまたはシンプルタイプ要素の名前リストを指定します。
任意の属性 オプション。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>