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 Wednesday, 7 November 2001 10:31:35 UTC