ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

XML スキーマ union 要素


XML Schema Reference 完全なXMLスキーマリファレンス

定義と用法

union 要素は、指定された単純データ型からの値の集合(和集合)として単純型を定義します。

要素情報

  • 親要素: simpleType

構文

<union
id=ID
memberTypes="list of QNames"
any attributes
>

(annotation?,(simpleType*))

</union>

(union 要素内で、? 記号は要素が 0 または 1 回出現できることを宣言します)

属性 説明
id オプション。 要素へユニークな ID を指定する
memberTypes オプション。組込みデータ型またはスキーマで定義されている simpleType 要素のリストを指定する
any attributes オプション。非スキーマ名前空間を持つ他の属性を指定する

例 1

この例は、2つの単純型の union である単純型を示しています:

<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 Schema Reference 完全なXMLスキーマリファレンス