XML Schema union ÔªËØ
¶¨ÒåºÍÓ÷¨
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>