XML Schema element union
تعریف و استفاده
element union چندین مجموعه از types defined by simpleType را تعریف میکند.
اطلاعات عنصر
تعداد دفعات ظاهر | یک بار |
پدر عنصر | simpleType |
محتوای | annotation،simpleType |
structures
<union id=ID memberTypes="list of QNames" attributes any > (annotation?,(simpleType*)) </union>
؟ (؟ نماد در element union بیان میکند که این عنصر میتواند صفر یا یک بار ظاهر شود.)
ویژگیها | توضیح |
---|---|
id | اختیاری. مشخص میکند ID منحصر به فرد برای این عنصر. |
memberTypes | اختیاری. لیست نامهای نوع دادههای داخلی تعریف شده در schema یا عناصر simpleType را مشخص میکند. |
attributes any | اختیاری. مشخص میکند که هرگونه属性 با نامفضای 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>