W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2004

Re: Include and no namespace

From: Xan Gregg <xan.gregg@jmp.com>
Date: Wed, 11 Aug 2004 09:00:31 -0400
Message-Id: <6D5B0077-EB96-11D8-A99A-000393BB384C@jmp.com>
Cc: <xmlschema-dev@w3.org>
To: "Arnaud Blandin" <ArnaudBlandin@wanadoo.fr>

You've got it about right, though when discussing these features it's 
useful to be clear about the distinction between a schema (the set of 
components) and a schema document (the .xsd xml document).  I'll 
rewrite your conclusion using "X.xsd" for the schema document and 
"schema(X.xsd)" for the schema produced from parsing X.xsd (and any 
necessary includes, redefines and imports).

> To me it means: when I include A.xsd in B.xsd, FooType belongs to the
> namespace 'myNamespace' within schema(B.xsd). Then by using redefine, 
> all the types of schema(B.xsd) are now in schema(C.xsd).
> Thus for the schema(C.xsd) point of view, FooType belongs to the 
> namespace
> 'myNamespace' and both Foo1 and Foo2 share the SAME type.

Correct if there is an xmlns="myNamespace" in B.xsd and C.xsd, which 
may be what you intended.  As it is, the type of Foo2 is FooType with 
no namespace, which doesn't correspond to any type in the schema.  Same 
for the type of Bar.

So to answer your initial question,

> How is a schema processor supposed to resolve the type of Foo2?

As it is (without the default namespace decl), a processor should not 
be able to resolve the type of Foo2.

xan
-------------------------------
A.xsd
=====
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="qualified">

  <xsd:complexType name="FooType">
  ...
  </xsd:complexType>
</xsd:schema>

B.xsd
=====
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="qualified"
             xmlns:test="myNamespace"
             targetNamespace="myNamespace">

  <xsd:include schemaLocation="A.xsd"/>
  <xsd:element name="Bar" type="FooType"/>

</xsd:schema>

C.xsd
=====
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="qualified"
             xmlns:test="myNamespace"
             targetNamespace="myNamespace">

  <xsd:redefine schemaLocation="B.xsd">
       <complexType name="FooType">
          ...
       </complexType>
  </xsd:redefine>

  <xsd:complexType name="type">
      <xsd:sequence>
           <xsd:element name="Foo1" type="test:FooType"/>
           <xsd:element name="Foo2" type="FooType"/>
      </xsd:sequence>
  </xsd:complexType>
</xsd:schema>
Received on Wednesday, 11 August 2004 13:00:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:10 UTC