Tuesday, October 7, 2008

xs:enumeration

xs:enumeration 定义了一个枚举的类型,比如我们定义一个新的URI类型,这个类型限制他的元素值只能包含下列的三个值,
http://www.w3.org/TR/xmlschema-0/
http://www.w3.org/TR/xmlschema-1/
http://www.w3.org/TR/xmlschema-2/
我们就需要想下面这样定义:
<xs:simpleType name="schemaRecommendations">
<xs:restriction base="xs:anyURI">
<xs:enumeration value="http://www.w3.org/TR/xmlschema-0/"/>
<xs:enumeration value="http://www.w3.org/TR/xmlschema-1/"/>
<xs:enumeration value="http://www.w3.org/TR/xmlschema-2/"/>
</xs:restriction>
</xs:simpleType>

No comments: