JSRUN 用代码说话

union 元素

编辑教程

union 元素

定义和用法

union 元素定义多个 simpleType 定义的集合。

元素信息

父元素: simpleType

语法

 <union
 id=ID
 memberTypes="list of QNames"
any attributes
 >

 (annotation?,(simpleType*))

 </union>

(? 符号声明在 union 元素中该元素可出现零次或一次。)

属性 描述
id 可选。规定该元素的唯一的 ID。
memberTypes 可选。规定在 schema 中定义的内置数据类型或 simpleType 元素的名称列表。
any attributes 可选。规定带有 non-schema 命名空间的任何其他属性。

实例

本例是一个合并了两个简单类型的简单类型:

 <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>
JSRUN闪电教程系统是国内最先开创的教程维护系统, 所有工程师都可以参与共同维护的闪电教程,让知识的积累变得统一完整、自成体系。 大家可以一起参与进共编,让零散的知识点帮助更多的人。
X
支付宝
9.99
无法付款,请点击这里
金额: 0
备注:
转账时请填写正确的金额和备注信息,到账由人工处理,可能需要较长时间
如有疑问请联系QQ:565830900
正在生成二维码, 此过程可能需要15秒钟