0
假设我有一个属性类型,允许的(0,1,2,3),即所有的组合中的任何值:XSD类型限制继承?
<xs:simpleType name="fourValues">
<xs:restriction base="xs:string">
<xs:enumeration value="0" />
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="0,1" />
<xs:enumeration value="0,2" />
<xs:enumeration value="0,3" />
<xs:enumeration value="0,4" />
<xs:enumeration value="1,2" />
<xs:enumeration value="1,3" />
<xs:enumeration value="2,3" />
<xs:enumeration value="0,1,2" />
<xs:enumeration value="0,1,3" />
<xs:enumeration value="0,2,3" />
<xs:enumeration value="1,2,3" />
<xs:enumeration value="0,1,2,3" />
</xs:restriction>
</xs:simpleType>
现在,如果我想定义一个类型,它是与上述相同的什么,但也允许空(NULL)值,如:
<xs:simpleType name="fourValues-null">
<xs:restriction base="xs:string">
<xs:enumeration value="" />
<xs:enumeration value="0" />
<xs:enumeration value="1" />
<xs:enumeration value="2" />
<xs:enumeration value="3" />
<xs:enumeration value="0,1" />
<xs:enumeration value="0,2" />
<xs:enumeration value="0,3" />
<xs:enumeration value="0,4" />
<xs:enumeration value="1,2" />
<xs:enumeration value="1,3" />
<xs:enumeration value="2,3" />
<xs:enumeration value="0,1,2" />
<xs:enumeration value="0,1,3" />
<xs:enumeration value="0,2,3" />
<xs:enumeration value="1,2,3" />
<xs:enumeration value="0,1,2,3" />
</xs:restriction>
</xs:simpleType>
是否有某种类型的继承,避免我列举的重复这两种类型的?
我有两个属性的使用:
<xs:attribute name="readingSources" type="fourValues" use="required" />
<xs:attribute name="targetFlip" type="fourValues-null" use="required">
我试图让targetFlip
属性type="fourValues"
和use="optional"
但它说,限制失败。