事无两极,一切皆是权衡

终于发现,这个世界遍地是金钱,到处是女人!

导航

Xml系列之 XSD(1)

Posted on 2007-03-30 18:02  中国小可  阅读(380)  评论(0)    收藏  举报
           在定义Xml结构时,时常用到属性的枚举,一时不知道怎么来定义,后来从Micofsoft的Web.Config  的Xsd中发现了定义方法:
         
 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.
            OK....................成功了