XML Schema include

Source: Internet
Author: User

first.xsd<?XML version= "1.0" encoding= "UTF-8"?><Xs:schemaXmlns:xs= "Http://www.w3.org/2001/XMLSchema"targetnamespace= "Www.myweb.com"xmlns= "Www.myweb.com">    <Xs:simpletypename= "Bid">        <xs:restrictionBase= "Xs:string">            <Xs:patternvalue= "[A]\d{6}"/>        </xs:restriction>    </Xs:simpletype></Xs:schema>
second.xsd<?XML version= "1.0" encoding= "UTF-8"?><Xs:schemaXmlns:xs= "Http://www.w3.org/2001/XMLSchema"xmlns= "Www.myweb.com"targetnamespace= "Www.myweb.com">    <Xs:simpletypename= "Aid">        <xs:restrictionBase= "Xs:string">            <Xs:patternvalue= "[C]\d{6}"/>        </xs:restriction>    </Xs:simpletype></Xs:schema>
third.xsd<?XML version= "1.0" encoding= "UTF-8"?><Xs:schemaXmlns:xs= "Http://www.w3.org/2001/XMLSchema"targetnamespace= "Www.myweb.com"xmlns= "Www.myweb.com">              <Xs:includeschemalocation= "First.xsd"/>    <Xs:includeschemalocation= "Second.xsd"/>    <xs:elementname= "Books"type= "InfoType"/>        <Xs:complextypename= "InfoType">        <xs:sequence>            <xs:elementname= "book"type= "BookType"/>        </xs:sequence>    </Xs:complextype>    <Xs:complextypename= "BookType">        <xs:sequence>            <xs:elementname= "title"type= "Xs:string"/>            <xs:elementname= "Author"type= "Atype"/>        </xs:sequence>        <Xs:attributename= "BookID"type= "Bid"/>    </Xs:complextype>    <Xs:complextypename= "Atype">        <xs:sequence>            <xs:elementname= "FirstName"type= "Xs:string"/>            <xs:elementname= "LastName"type= "Xs:string"/>        </xs:sequence>        <Xs:attributename= "Authorid"type= "Aid"/>    </Xs:complextype></Xs:schema>

Description

First.xsd: Defines a simple type and specifies that the target namespace is "www.myweb.com";

Second.xsd: Defines a simple type and specifies that the target namespace is "www.myweb.com";

Third.xsd: Define complex types, and reference first.xsd, Second.xsd, refer to these two schema files if the target namespace is consistent. Because third.xsd references first.xsd, second.xsd must specify the default namespace as "Www.myweb.com", otherwise it cannot reference the simple type data defined in Firtst.xsd, second.xsd;

Target namespace: Specifies the namespace from which the elements and data types that are constrained by this schema document are derived;

Default namespace: Specifies the namespace from which the elements and data types used in the current XML document are derived;

XML Schema include

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.