[XSD learning]xsd essential elements

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.