One, XSD common data format
Xs:stringxs:decimalxs:integerxs:booleanxs:datexs:time
Second, simple elements
<name= "xxx" type= "yyy" default= "AAA" Fixed= "bbb"/>
which
XXX represents the element name,
YYY represents the data format,
AAA represents the element default value, and if there is no value, the element value is AAA,
BBB indicates that the element is a fixed value BBB, and if the other value is an error
The XSD file corresponding to the XML message in the following format is:
< LastName > Smith</lastname><age></ Age ><Dateborn>1980-03-27</ Dateborn>
This is the corresponding simple element definition:
<xs:elementname= "LastName"type= "Xs:string"default= "Zhang San"/><!--represents the definition LastName, and if the data is empty, the default is Zhang San -<xs:elementname= "Age"type= "Xs:integer"fixed= "+"/><!--define age with a fixed value of 28 and an error if it is a different value -<xs:elementname= "Dateborn"type= "Xs:date"/>
Third, attribute
A simple element is an element that has no attributes and, if it owns an attribute, becomes a composite element. This section mainly describes the declaration of elements.
< Xs:attribute name = "XXX" type = "yyy" default = "AAA" fixed = "BBB" />
which
XXX represents the property name,
YYY represents the data format, the attribute format references the first section,
AAA represents the property default value, and if there is no value, the property value is AAA,
BBB indicates that the property is a fixed value BBB, and if the other value is an error
For example:
<name= "lang" type= "xs:string" default= "EN" /><name= "encodding" type= "xs: String " fixed=" GBK "/>
The corresponding XML, where Lang is cn, overrides en settings, encoding can only be GBK
<lang= "CN" encoding= "GBK">zhangsan</ lastName>
[XSD learning]xsd essential elements