XML Schema union อิเลิมน์

การกำหนดและการใช้งาน

union อิเลิมน์กำหนดชุดของ simpleType ที่ถูกกำหนดโดย simpleType หลายอย่าง.

ข้อมูลเอลิเมนต์

ความเป็นไปได้ที่จะปรากฏของเอลิเมนต์ ครั้ง
เอลิเมนต์พ่อ simpleType
เนื้อหา annotation, simpleType

กฎการใช้งาน

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

(? สัญญาณปรากฏใน element ของ union นี้สามารถปรากฏขึ้น 0 หรือ 1 ครั้ง。)

คุณสมบัติ คำอธิบาย
id เลือกตั้งได้. กำหนด ID แห่งนี้ของ element นี้.
memberTypes เลือกตั้งได้. กำหนดรายชื่อของ data type หรือ simpleType ที่ถูกกำหนดใน schema.
any attributes เลือกตั้งได้. กำหนดคุณสมบัติอื่นที่มีชื่อเรียกที่ไม่อยู่ใน schema.

ตัวอย่าง

ตัวอย่าง 1

นี่คือตัวอย่างของ simpleType ที่รวมกันจาก simpleType สองอย่าง:

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