Elemen gabungan Skema XML
Referensi Skema XML Lengkap
Definisi dan Penggunaan
Elemen union mendefinisikan tipe sederhana sebagai kumpulan (penyatuan) nilai dari tipe data sederhana yang ditentukan.
Informasi Elemen
- Elemen induk: simpleType
Sintaksis
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(Tanda ? menyatakan bahwa elemen dapat muncul nol atau satu kali di dalam elemen gabungan)
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 |
Contoh 1
Contoh ini menunjukkan tipe sederhana yang merupakan gabungan dari dua tipe sederhana:
<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>
Referensi Skema XML Lengkap