Sjednocovací prvek schématu XML
❮ Vyplňte odkaz na schéma XML
Definice a použití
Element union definuje jednoduchý typ jako kolekci (sjednocení) hodnot ze zadaných jednoduchých datových typů.
Informace o prvku
- Nadřazené prvky: simpleType
Syntax
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(Znak ? deklaruje, že prvek se může uvnitř sjednocovacího prvku vyskytovat nula nebo jednou)
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 |
Příklad 1
Tento příklad ukazuje jednoduchý typ, který je spojením dvou jednoduchých typů:
<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>
❮ Vyplňte odkaz na schéma XML