import vs prefixing

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?

Also, while on the subject of import....
There is also a statement in the specs [Structures 6.2.3] - "When a
schemaLocation is present, it must contain a single URI reference which
the schema author warrants will resolve to a schema document containing
the component(s) in the imported namespace referred to elsewhere in the
containing schema document."  This sounds to me like a constraint
(although it doesn't appear in the src) that components referred to
elsewhere in the containing document _must_ come from this schema
document.  I'm pretty sure this is not the case as schemaLocation is,
elsewhere, _always_ used as a _hint_only_.  In which case, is this
statement saying that the schema document, if resolved, _must_ have at
least one component that is in a schema information item that has a
targetNamespace that matches the import statement?

thanks for any help on this.

mick.

Received on Wednesday, 17 January 2001 05:37:54 UTC