Include and no namespace

Hi all,

I have a question regarding the includes of XML Schemas with no namespace.
Consider the following example:

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>


How a schema processor is supposed to resolve the type of Foo2? 
Regarding the include of schema with no namespace I found this in the spec:

"In Schema Representation Constraint: Inclusion Constraints and Semantics 

3.2 If clause 2.3 above is satisfied, then the schema corresponding to the
<include>d item's parent <schema> must include not only definitions or
declarations corresponding to the appropriate members of its own [children],
but also components identical to all the *schema components* of I, except
that anywhere the *absent* target namespace name would have appeared, the
*actual value* of the targetNamespace [attribute] of SII' is used. In
particular, it replaces *absent* in the following places: 
3.2.1 The {target namespace} of named schema components, both at the top
level and (in the case of nested type definitions and nested attribute and
element declarations whose code was qualified) nested within definitions;
3.2.2 The {namespace constraint} of a wildcard, whether negated or not;"

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

Is my interpretation correct?

Regards,

Arnaud

Received on Wednesday, 11 August 2004 09:17:39 UTC