在定义Xml结构时,时常用到属性的枚举,一时不知道怎么来定义,后来从Micofsoft的Web.Config 的Xsd中发现了定义方法:
OK....................成功了
1
<xs:attribute name="MustMame" use="required">
2
<xs:simpleType>
3
<xs:restriction base="xs:NMTOKEN">
4
<xs:enumeration value="Forms"/>
5
<xs:enumeration value="None"/>
6
<xs:enumeration value="Passport"/>
7
<xs:enumeration value="Windows"/>
8
</xs:restriction>
9
</xs:simpleType>
10
</xs:attribute>
要在你的属性声明下加 restriction(约束)无素,同时要为base指定为:xs:NMTOKEN.
<xs:attribute name="MustMame" use="required">2
<xs:simpleType>3
<xs:restriction base="xs:NMTOKEN">4
<xs:enumeration value="Forms"/>5
<xs:enumeration value="None"/>6
<xs:enumeration value="Passport"/>7
<xs:enumeration value="Windows"/>8
</xs:restriction>9
</xs:simpleType>10
</xs:attribute>OK....................成功了
浙公网安备 33010602011771号