xml schema 提问,求解答
我的xml文件里可能出现下面两个标签
<attribute type="charset">utf8</attribute>
<attribute type="class">blog</attribute>
charset对应utf8、gb18030等
class对应www、news、blog等
怎么通过限定不会让他们交叉
现在的代码如下,会产生交叉
<!--定义attribute合法值类型-->
<xs:simpleType name="attvalue">
<xs:restriction base="xs:string">
<xs:pattern value="www|news|blog|utf8|gb18030"/>
</xs:restriction>
</xs:simpleType>
<!--定义attribute类型-->
<xs:complexType name="attributeType">
<xs:simpleContent>
<xs:extension base="attvalue">
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="charset"/>
<xs:enumeration value="class"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>