عنصر اتحاد مخطط XML
❮ مرجع مخطط XML الكامل
التعريف والاستخدام
يعرّف عنصر التوحيد نوعًا بسيطًا على أنه مجموعة (توحيد) للقيم من أنواع بيانات بسيطة محددة.
معلومات العنصر
- العناصر الأصلية: simpleType
بناء الجملة
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType*))
</union>
(تعلن العلامة أن العنصر يمكن أن يحدث صفرًا أو مرة واحدة داخل عنصر الاتحاد)
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 |
مثال 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>
❮ مرجع مخطط XML الكامل