Instance of the schema constraint XML file

Source: Internet
Author: User
Tags xmlns

It Programmer development Essentials-all kinds of resources download list, history of the most IT resources, personal collection summary. shiporder_1.xsd File:

<?xml version= "1.0" encoding= "UTF-8"?>

<xs:schema xmlns:xs= "Http://www.w3.org/2001/XMLSchema"

Targetnamespace= "Http://www.itstar.cn/shiporder_1"

elementformdefault= "qualified" >

<xs:element name= "Shiporder" >

<xs:complexType>

<xs:sequence>

<xs:element name= "Orderperson" type= "xs:string"/>

<xs:element name= "ShipTo" >

<xs:complexType>

<xs:sequence>
< xs:element name= "name" type= "xs:string"/>

<xs:element name= "Address" type= "xs:string"/>

<xs:element name= "City" type= "xs:string"/>

<xs:element name= "Country" type= "xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name= "Item" maxoccurs= "unbounded" >

<xs:complexType>

<xs:sequence>

<xs:element name= "title" Type= "Xs:string"/>

<xs:element name= "Note" type= "xs:string" minoccurs= "0"/>

<xs:element name= "Quantity" type= "Xs:positiveinteger" ></xs:element>

<xs:element name= "Price" type= "Xs:decimal"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

<xs:attribute name= "OrderID" type= "xs:string" use= "required"/>

</xs:complexType>

</xs:element>

</xs:schema>

shiporder_2.xsd File: (I don't know why this method cannot add the targetnamespace attribute)

<?xml version= "1.0" encoding= "UTF-8"?>

<xh:schema xmlns:xh= "Http://www.w3.org/2001/XMLSchema"

elementformdefault= "qualified" >

<!--simple element definition--

<xh:element name= "Orderperson" type= "xh:string"/>

<xh:element name= "name" type= "xh:string"/>

<xh:element name= "Address" type= "xh:string"/>

<xh:element name= "City" type= "xh:string"/>

<xh:element name= "Country" type= "xh:string"/>

<xh:element name= "title" Type= "Xh:string"/>

<xh:element name= "Note" type= "xh:string"/>

<xh:element name= "Quantity" type= "Xh:positiveinteger"/>

<xh:element name= "Price" type= "Xh:decimal"/>

<!--definition of properties--

<xh:attribute name= "OrderID" type= "xh:string"/>

<!--definition of composite elements--

<xh:element name= "ShipTo" >

<xh:complexType>

<xh:sequence>

<xh:element ref= "Name"/>

<xh:element ref= "Address"/>

<xh:element ref= "City"/>

<xh:element ref= "Country"/>

</xh:sequence>

</xh:complexType>

</xh:element>


<xh:element name= "Item" >

<xh:complexType>

<xh:sequence>

<xh:element ref= "title"/>

<xh:element ref= "Note" minoccurs= "0"/>

<xh:element ref= "Quantity"/>

<xh:element ref= "Price"/>

</xh:sequence>

</xh:complexType>

</xh:element>


<xh:element name= "Shiporder" >

Related Article

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.