Use xlink to import another XML schema : xlink « XML Schema « XML

Home
XML
1.CSS Style
2.SVG
3.XML Schema
4.XQuery
5.XSLT stylesheet
XML » XML Schema » xlink 
Use xlink to import another XML schema


File: Data.xml

<?xml version="1.0"?>
<Sortie xmlns="http://www.java2s.com"
         xmlns:xlink="http://www.w3.org/1999/xlink/namespace"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation=
                   "http://www.java2s.com
                    Schema.xsd">
    <SORTIE-DATA>...</SORTIE-DATA>
    <Aircraft xlink:href="https://www.java2s.com"/>
</Sortie>


File: Schema.xsd

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.java2s.com"
            xmlns="http://www.java2s.com"
            xmlns:xlink="http://www.w3.org/1999/xlink/namespace"
            elementFormDefault="qualified">
    <xsd:import namespace="http://www.w3.org/1999/xlink/namespace"
                schemaLocation="xlink.xsd"/>
    <xsd:element name="Sortie">
        <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="SORTIE-DATA" type="xsd:string"/>
                 <xsd:element name="Aircraft" maxOccurs="unbounded"
                     <xsd:complexType>
                         <xsd:sequence/>
                         <xsd:attribute ref="xlink:href" use="required"/>
                     </xsd:complexType>
                 </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>


File: xlink.xsd

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.w3.org/1999/xlink/namespace"
            xmlns="http://www.w3.org/1999/xlink/namespace"
            elementFormDefault="qualified">
    <xsd:attribute name="href" type="xsd:anyURI"/>
</xsd:schema>

 
Related examples in the same category
1.attribute with referencing xlink
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.