W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2003

Re: import/include question

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 13 May 2003 22:55:27 -0400
To: "Rajul Gupta" <rajul@oss.com>
Cc: "XML Schema Dev" <xmlschema-dev@w3.org>
Message-ID: <OFCEC22025.799F584A-ON85256D26.00104784@lotus.com>

If I'm following your example, this is not legal because A.xsd has an 
explicit reference to a component from namespace http://www.example.com/N1 
but no import for that namespace.  The rule is, each document must declare 
its dependencies on anything it explicitly references.  Namespaces that 
are used implicitly (for example the base type of some type) need not be 
imported by your schema document.  I hope this helps.

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







"Rajul Gupta" <rajul@oss.com>
Sent by: xmlschema-dev-request@w3.org
05/13/2003 04:51 PM

 
        To:     "XML Schema Dev" <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        import/include question


Hi,
 
I have one question about the import/include. I have following three 
schemas. A.xsd and C.xsd have same targetNamespace N1; and B.xsd has 
targetNamespace N2. A.xsd imports B.xsd, and B.xsd imports C.xsd. Is this 
example legal since there is no direct "include" between A.xsd and C.xsd?
 
Thanks in advance,
 
Rajul
--------------------------------------------------------------------------
A.xsd:
 
<xs:schema targetNamespace="http://www.example.com/N1" 
 xmlns:n2="http://www.example.com/N2" 
 xmlns:n1="http://www.example.com/N1" 
 xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
 <xs:import namespace="http://www.example.com/N2" schemaLocation="b.xsd"/>
 
 <xs:complexType name="MyType">
  <xs:sequence>
   <xs:element ref="n1:el"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:element name="root" type="n1:MyType"/>
 
</xs:schema>
 
-------------------------------------------------------------------------
 
B.xsd:
 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 xmlns="http://www.example.com/N2"
 targetNamespace="http://www.example.com/N2">
 
 <xs:import schemaLocation="c.xsd" namespace="http://www.example.com/N1"/>
 
</xs:schema>
 
--------------------------------------------------------------------------
 
C.xsd:
 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 xmlns="http://www.example.com/N1"
 targetNamespace="http://www.example.com/N1"> 
 
 <xs:element name="el" type="xs:integer"/>
 
</xs:schema>
 
-------------------------------------------------------------------------
Received on Tuesday, 13 May 2003 23:05:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:37 GMT