Re: include and import

My understanding is as follows;

With include the only components that become part of the target namespace
are those that are unqualified ( in no namespace ). So in your example
Schema A consists of {http://www.example.org/A}{eB}. It may also contain
{http://www.example.org/C}{eC} but as Schema B never refers to anything in
the http://www.example.org/C namespace it's hard to tell. It will *never*
contain anything called {http://www.example.org/A}{eC}

Because B imports C, the declarations in C are unchanged, they stay in the
http://www.example.org/C namespace. So when B is included by A on eB becomes
part of the http://www.example.org/A namespace.

The crucial part of 6.2.1 is

or (b) no targetNamespace at all, in which case all the top-level included
components are converted to the includeing schema document's
targetNamespace.

Note that it refers to *top-level* components. The components defined in
schema C are not top-level components with respect to schema B.

Hope this helps,

Martin Gudgin
DevelopMentor


----- Original Message -----
From: <afo@zurich.ibm.com>
To: <www-xml-schema-comments@w3.org>
Sent: Thursday, February 15, 2001 9:59 AM
Subject: include and import


>
>
>
> The spec  (Section 6.2.1 of Part I)  says that if a schema A,  which has a
> non null target namespace, includes a schema B without target namespace,
> all components of B are included in schema A and their namespace becomes
> the same as the target namespace of A.
>       However, although  schema B does not have any target namespace, it
> may have components with a non null namespace ( for instance if schema B
> imports another schema whose target namespace is not null). So if my
> reading of the spec is correct, we should also change the namespace of
> these
> components to the target namespace of schema A.
>
>       Example:
>
>      A.xsd
>      <schema targetNamesapce="http://www.example.org/A"
>           xmlns="http://www.w3.org/2000/10/XMLSchema"
>           xmlns:tns="http://www.example.org/A">
>
>           <include schemaLocation="B.xsd"/>
>
>      </schema>
>
>      B.xsd
>      <xsd:schema  xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
>
>           <xsd:import namespace="http://www.example.org/C"
> schemaLocation="C.xsd"/>
>
>           <xsd:element name="eB" type="xsd:string"/>
>
>      </xsd:schema>
>
>      C.xsd
>      <schema targetNamesapce="http://www.example.org/C"
>           xmlns="http://www.w3.org/2000/10/XMLSchema"
>           xmlns:tns="http://www.example.org/C">
>
>           <element name="eC" type="xsd:string"/>
>
>      </schema>
>
>       According to the spec, schema A  consists of
> {http://www.example.org/A}{eB} and {http://www.example.org/A}{eC} but I
> wonder if it should not consist of {http://www.example.org/A}{eB} and
> {http://www.example.org/C}{eC} .
>
>      Regards,
>
>      Achille Fokoue.
>
>
>

Received on Thursday, 15 February 2001 07:14:42 UTC