schema redefinitions [ schema A redefines schema B and B redefines A]

Hi,

I'm trying to figure out how a schema processor must handle schema
redefinition.
Here is a case where I'm not sure of what  the right behavior should  be:

A.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
     <xsd:redefine schemaLocation="B.xsd">
          <xsd:complexType name="B">
     <xsd:complexContent>
                    <xsd:restriction base="B">
                         <xsd:sequence>
                    <xsd:element name="eB1" type="B" minOccurs="0"/>
                    <xsd:element name="eB2" type="A" minOccurs="1"
id="eB2_in_A.xsd"/>
               </xsd:sequence>
                     </xsd:restriction>
     </xsd:complexContent>
          </xsd:complexType>
     </xsd:redefine>
     <xsd:complexType name="A">
          <xsd:sequence>
          <xsd:element name="eA1" type="A" minOccurs="0"/>
          <xsd:element name="eA2" type="B" minOccurs="0"/>
       </xsd:sequence>
     </xsd:complexType>
</xsd:schema>

B.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">

     <xsd:redefine schemaLocation="A.xsd">
                    <xsd:complexType name="A">
               <xsd:complexContent>
                              <xsd:restriction base="A">
                                   <xsd:sequence>
                              <xsd:element name="eA1" type="A"
minOccurs="0"/>
                              <xsd:element name="eA2" type="B"
minOccurs="1"/>
                         </xsd:sequence>
                               </xsd:restriction>
               </xsd:complexContent>
                    </xsd:complexType>
     </xsd:redefine>
          <xsd:complexType name="B">
                    <xsd:sequence>
               <xsd:element name="eB1" type="B" minOccurs="0"/>
               <xsd:element name="eB2" type="A" minOccurs="0"
id="eB2_in_B.xsd"/>
          </xsd:sequence>
      </xsd:complexType>
</xsd:schema>

Is it valid if a schema A redefines a schema B and schema B redefines
schema A as shown in the previous example?

If the answer to the previous question is yes, I would like to understand
our a schema processor should behave while
reading A.xsd. I would like to know if:
 1/ reference to type A used in the element <xsd:element> whose id is
"eB2_in_A.xsd" in schema document A.xsd
refers to the complexType A defined in A.xsd or to its redefined version
located at B.xsd.
 2/ reference to type A used in the element <xsd:element> whose id is
"eB2_in_B.xsd" in schema document B.xsd
refers to the complexType A defined in A.xsd or to its redefined version
located at B.xsd.

If both references refer to the same complexType A defined in A.xsd, it
means that the schema processor may skip the
redefine statement in B.xsd since components being redefined in B.xsd will
never be used.  In this case, the schema
 document in B.xsd is equivalent to:
B.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">

     <!--
     <xsd:redefine schemaLocation="A.xsd">
          <xsd:complexType name="A">
          <xsd:complexContent>
                    <xsd:restriction base="A">
                         <xsd:sequence>
                         <xsd:element name="eA1" type="A" minOccurs="0"/>
                         <xsd:element name="eA2" type="B" minOccurs="1"/>
                    </xsd:sequence>
                     </xsd:restriction>
          </xsd:complexContent>
          </xsd:complexType>
     </xsd:redefine>
     -->
       <xsd:complexType name="B">
          <xsd:sequence>
          <xsd:element name="eB1" type="B" minOccurs="0"/>
          <xsd:element name="eB2" type="A" minOccurs="0"
id="eB2_in_B.xsd"/>
       </xsd:sequence>
     </xsd:complexType>
</xsd:schema>

Otherwise, if the two references don't refer to the same type, I think it
violates  clause 2 of Schema Properties Correct (§5.13)
("Each of the {type definitions}, {element declarations}, {attribute group
definitions}, {model group definitions} and
{notation declarations} must not contain two or more schema components with
the same {name} and {target namespace}.)

Thank you for your help.

Achille Fokoue

Received on Wednesday, 31 January 2001 10:34:10 UTC