<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.person.skydream.com" xmlns="http://www.person.skydream.com" > <xs:element name="tools" type="toolsInfo"/> <xs:complexType name="toolsInfo"> <xs:all> <xs:element name="book" type="xs:string" default="Spring in Action" minOccurs="0" maxOccurs="10"> <xs:complexType> <xs:attribute name="price" type="xs:integer" default="30" use="required"/> </xs:complexType> </xs:element> <xs:element name="car"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf"/> <xs:enumeration value="BMW"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:all> </xs:complexType> </xs:schema>@H_502_0@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.person.skydream.com" xmlns="http://www.person.skydream.com" >@H_502_0@xmlns:xs:提供了本文档使用的xml 标签定义uri @H_502_0@targetNamespace与xmlns 指明本文档定义的scheml的uri
<xs:element name="tools" type="toolsInfo"/>@H_502_0@ 定义了一个tools元素,其具体定义指向toolsInfo
<xs:complexType name="toolsInfo"> <xs:all> <xs:element name="book" type="xs:string" default="Spring in Action" minOccurs="0" maxOccurs="10"> <xs:complexType> <xs:attribute name="price" type="xs:integer" default="30" use="required"/> </xs:complexType> </xs:element> <xs:element name="car"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf"/> <xs:enumeration value="BMW"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:all> </xs:complexType>@H_502_0@
复杂元素 @H_502_0@ default:默认值 @H_502_0@ type:类型 @H_502_0@ minOccurs:最小个数 @H_502_0@<xs:attribute> 定义元素的属性 @H_502_0@<xs:simpleType>定义袁术的取值限定范围 @H_502_0@详细内容参考:http://www.w3school.com.cn/schema/schema_dtypes_numeric.asp