XML Schema elemento unione
Definizione e utilizzo
elemento di unione simpleType definisce una pluralità di raccolta definiti.
Informazioni elemento
- elemento principale: simpleType
grammatica
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(? Sign dichiara che l'elemento può verificarsi zero o una volta nell'elemento unione.)
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
memberTypes | 可选。规定在 schema 中定义的内置数据类型或 simpleType 元素的名称列表。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
esempio 1
Questo esempio è una semplice fusione dei due tipi di tipi semplici:
<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 completo Schema di riferimento