XML Schema union element

ການນຳໃຊ້ ແລະ ຄວາມຈິງ

union ປະກອບຕົວກຳນົດຄວາມກວມທັງບັນດາ simpleType.

ຂໍ້ມູນປະກອບຕົວ

ຈຳນວນການອອກແບບ ຄັ້ງ
ປະກອບຕົວພື້ນຖານ simpleType
ຂອບເຂດ annotation、simpleType

ກົດລະບຽບ

<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>

(? ອີກອີກ ສະນັ້ນປະກອບຕົວສາມາດອອກຢູ່ບ່ອນດຽວຫຼືບໍ່ມີຢູ່ union.)

ປະກອບຕົວ ການອະທິບາຍ
id ຄວາມສາມາດ. ກໍານົດ ID ສະຖິຕິຂອງປະກອບຕົວ.
memberTypes ຄວາມສາມາດ. ກໍານົດລາຍການຊື່ວິທະຍາຂໍ້ມູນພາຍໃນ schema ຫຼື simpleType.
any attributes ຄວາມສາມາດ. ກໍານົດປະກອບຕົວຊີ້ນັກກົດລະບຽບ non-schema.

ຄວາມຈິງ

ຕົ້ນຫນັງ 1

ບັນທັດນີ້ແມ່ນບັນດາຮູບແບບລະອຽດທີ່ປະສົມກັນສອງຮູບແບບລະອຽດສະດວກກັນ:

<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>