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

Import Vs. Include

From: Chang Li <write_chang@hotmail.com>
Date: Mon, 25 Mar 2002 23:54:27 -0500 (EST)
To: <xmlschema-dev@w3.org>
Message-ID: <OE35su1enHv1cO9MH7C0000128a@hotmail.com>
While I was reading the specification of XML Schema, I am a little confused by "include" and "import".  It sounds like "include" can only include schemas that share the same target namespace with the including schema, while import can import schemas that have different namespaces.  When we use include, we include both the declaration of elements and the definition of types.  Both elements and types can be used in the including schema.  It looks as if we have cut and pasted the included schemas in the including schema and make a single large schema definition file out of all the involved schemas.  In the case of a "import", however most of the examples I have seen so far indicate that when I am using "import", I usually only import the types defined in the imported schema to declare elements or attributes in the importing schema.  Is it true that I can not refer to elements defined in the imported schema? If it is not true, is it fair to say that the importing schema now has elements from different target namespace?  How will document instance refer to elements that are from different namespaces in this case, do I have to declare xmlns for both namespaces and qualify the element names?

Thanks.

Chang 
Received on Tuesday, 26 March 2002 10:15:00 GMT

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