Re: How is the <import> element handled

For a general motivation on import see the thread at [1] and especially my 
response at [2].  The  <import>s in your schema gives the processor a list 
of the namespaces that will be used in references to other schema 
components, such as element declarations.  The schemaLocation on <import> 
is a hint, which will be honored by those processors that trust one schema 
document to indicate where others are located (sometimes you want to be 
sure you know what you're using as the definition of a namespace.)

[1] 
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2001JulSep/0006.html
[2] 
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2001JulSep/0011.html

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------







andrew.hickman@philips.com
Sent by: xmlschema-dev-request@w3.org
11/07/01 10:25 AM

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/CAM/Lotus)
        Subject:        How is the <import> element handled


Hi,

I have some questions about use of the import statement. I am
unclear as to exactly what it achieves. The example below shows some
types I am defining some types for use in SOAP transactions - these
will eventually be used by a WSDL file.

<schema targetNamespace="http://www.tv-anytime.org/2001/11/transport/types"
          xmlns:tns="http://www.tv-anytime.org/2001/11/transport/types"
          xmlns:tva_metadata="http://www.tv-anytime.org/2001/08/metadata"
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns="http://www.w3.org/2001/XMLSchema">

  <import namespace="http://www.tv-anytime.org/2001/08/metadata"
          schemaLocation="tva_v11.xsd"/>
  <import namespace="http://schemas.xmlsoap.org/soap/ecoding/"
          schemaLocation="soap-enc.xsd"/>
  <element name="ArrayOfCrids">
    <complexType>
      <complexContent>
        <restriction base="soapenc:Array">
          <attribute ref="soapenc:arrayType" 
default="tva_metadata:CRIDType[]"/>
        </restriction>
      </complexContent>
    </complexType>
  </element>
</schema>

If I remove the first import statement the schema becomes invalid
(according to XML Spy). However, if I remove the second import
statment the schema is valid. Is this because it's a schema aware
processor so it knows to try and resolve QNames on some attribute
types (in this case base and ref) but it doesn't do so for the
default tag?



The specification seems to give contradictory messages on what
exactly the import statement points to if it has a schemaLocation
attribute.

In "Schema Representation Constraint: Import Constraints and
Semantics" it says:

"2 If the application schema reference strategy using the actual
  values of the schemaLocation and namespace [attributes], provides
  a referent, as defined by Schema Document Location Strategy
  (§4.3.2), one of the following must be true:

 2.1 The referent is (a fragment of) a resource which is an XML
   document (see clause 1.1), which in turn corresponds to a
   <schema> element information item in a well-formed information
   set, which in turn corresponds to a valid schema.

 2.2 The referent is a <schema> element information item in a
   well-formed information set, which in turn corresponds to a valid
   schema."

Whereas, in "3.15.2.1 References to Schema Components" it says

"Reference to schema components from a schema document is managed in
a uniform way, whether the component corresponds to an element
information item from the same schema document or is imported
(References to schema components across namespaces (§4.2.3)) from an
external schema (which may, but need not, correspond to an actual
schema document). The form of all such references is a QName."

Does the import have to point to a schema element information item
or not?



If I now define another schema, which needs to reference the
namespaces in the above schema (i.e. those corresponding to the
prefix tns, tva_metadata and soapenc) do I need to have an import
statement for all 3 of these namespaces of does importing the above
targetNamespace automatically chain the other 2?



WSDL allows me to put an import statement inside a WSDL file which
is an XML instance document. I would like to do this to separate the
service type interface and the service implementation. This pseudo
mix of schema and instance document constructs has left me
confused. Am I right in thinking that the use of an import statement
in a WSDL file has no effect on a schema processor, but could do a
WSDL aware processor?

Thanks for your help,

Andy


Andrew Hickman
Interactive Systems Group
Philips Research Laboratories, UK
Tel:  +44 (0) 1293 815167
Fax:  +44 (0) 1293 815500

Received on Friday, 9 November 2001 16:11:50 UTC