Element unii schematów XML
❮ Pełne odniesienie do schematu XML
Definicja i użycie
Element union definiuje typ prosty jako zbiór (unia) wartości z określonych prostych typów danych.
Informacje o elemencie
- Elementy nadrzędne: simpleType
Składnia
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(Znak ? deklaruje, że element może wystąpić zero lub jeden raz wewnątrz elementu unii)
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 |
Przykład 1
Ten przykład pokazuje prosty typ, który jest połączeniem dwóch prostych typów:
<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>
❮ Pełne odniesienie do schematu XML