W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Import Vs. Include.

From: Bob Schloss <rschloss@us.ibm.com>
Date: Tue, 18 Jun 2002 15:59:29 -0400
To: <supadhye@cisco.com>, xmlschema-dev@w3.org
Message-ID: <OFA40FBB9F.824D253D-ON85256BDC.006D356F@us.ibm.com>
                                                                                                               
                                                                                                               
                                                                                                               


Sunil,

Generally speaking, if some elements, attributes and types are being
defined by one organization (in this case IMS), and other elements,
attributes and types are being defined by your organization (in this case
CISCO), or your organization is subclassing the type definitions of the
other organization, you should use <import>.

Think about this over a period of time.  If you use <include> and at a
later date receive a revised schema document from IMS in which they happen
to have chosen as a component name a name that you have already used, you
are in big trouble!  If you use <import> and at a later date you receive a
revised schema document from IMS in which they happen to have chosen as a
component name, there is no problem because your component is in your
targetNamespace, while there component is in their targetNamespace.

What you need to add to your fragment shown below is this namespace
declaration:
            xmlns:prefix="http://www.imsglobal.org/xsd/imsmd_rootv1p2p2"

so that you can use "prefix" followed by a colon just before the name of
any component that is defined in the IMS namespace.
You might as well add this to your schema element.

I think this is one point that some of the commercial XML Schema books make
pretty clear.  You probably want to get a hold of one of them.

Bob Schloss
IBM Watson Research
Hawthorne, NY USA






"sunil" <supadhye@cisco.com>@w3.org on 06/18/2002 08:42:53 AM

Please respond to <supadhye@cisco.com>

Sent by:    xmlschema-dev-request@w3.org


To:    <xmlschema-dev@w3.org>
cc:
Subject:    Import Vs. Include.







Hi
In my current csco_md_... xmlschema I have referenced another schema (the
ims schema) in the following way

   <xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema
            targetNamespace=”
http://www.cisco.com/elearning/xsd/ciscomd_v001”
            xmlns=http://www.cisco.com/elearning/xsd/ciscomd_v001
            elementFormDefault=”qualified” version="csco_elearning Version
0.0.1">

            <xsd:import
namespace="http://www.imsglobal.org/xsd/imsmd_rootv1p2p2"
                                schemaLocation="imsmd_rootv1p2p2.xsd"/>


However, I read in documentation that I am supposed to do it differently.
That document says:
?       The include element allows you to access components in other
schemas
-    All the schemas you include must have the same namespace as your
schema
(i.e., the schema that is doing the include)
-   The net effect of include is as though you had typed all the
definitions
directly into the containing schema

and gives the following example:
<xsd:schema …殺俎>
    <xsd:include schemaLocation="LibraryBook.xsd"/>
    <xsd:include schemaLocation="LibraryEmployee.xsd"/>
    …殺俎
</xsd:schema>


Which is right?  How should I include/import the ims schema, and what's the
difference between the way I did it and they did it?
Thanks.
Sunil
Received on Tuesday, 18 June 2002 16:00:59 GMT

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