W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2001

Re: import vs prefixing

From: <Noah_Mendelsohn@lotus.com>
Date: Thu, 18 Jan 2001 17:16:36 -0500
To: ht@cogsci.ed.ac.uk (Henry S. Thompson)
Cc: michael@research.canon.com.au, xmlschema-dev@w3.org
Message-ID: <OF7F7B0068.17A7C05A-ON852569D8.003FC1DC@lotus.com>
Michael Anderson writes:

>> I'm curious to know the difference between the two following schemas
>> <schema xmlns="http://www.w3.org/2000/XMLSchema"
>>               xmlns:cisra = "http://cisra.au">
>>   <import namespace="http://cisra.au"
>>                schemaLocation="http://www.cisra.com.au/mySchema.xsd"/>
>>     <element name="food" type="cisra:Weetbix"/>
>> </schema>
>> 
>> AND
>> 
>> <schema xmlns="http://www.w3.org/2000/XMLSchema"
>>               xmlns:cisra = "http://cisra.au">
>>               xsi:schemaLocation="http://cisra.au
>> 
>> http://www.cisra.com.au/mySchema.xsd"/>
>>     <element name="food" type="cisra:Weetbix"/>
>> </schema>
>> 
>> Is it that you _must_ import the namespace using <import> before you 
can
>> use components from it in your schema?
>> 

Henry has answered your question, I think.  I thought it might be useful 
to explain some of the philosphy behind our design.   The latter 
construction signals that you are (probably) establishing the namespace 
prefixed by cisra for use in the schema document it self.  Imagine that 
instead of cisra: you were setting a prefix xsd2:  which might add 
features to some future version of the schema language:

        <xsd:schema xmlns:xsd="http://www.w3.org/2000/XMLSchema"
                xmlns:xsd2="http://www.w3.org/2001/XMLSchema2"
                <xsd:element>....</xsd:element>
                <xsd2:superComplexType>
                        ...
                </xsd2:superComplexType>
        </xsd:schema>


 Your first example, with import, signals that the namespace provides 
constructions that validate content of the instance document being 
validated.  We debated these mechanisms for a long time, and settled on 
the current design as one that would balance use of existing namespace 
mechanisms (prefixes, QNames, xmlns: declarations, etc.) with an ability 
to clearly signal to processors the namespaces for which schemas are 
needed (I.e. imported)  vs. those used for other purposes.

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------
Received on Thursday, 18 January 2001 17:27:21 GMT

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