Re: import vs prefixing

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 UTC