Element Declarations Consistent and valid type substitutions via xsi:type

Hi

recently I found the proposed extension to the "Element Declarations
Consistent"
constraint as described in 
 
http://www.w3.org/XML/Group/2002/07/xmlschema-1.1-current-reqs-list.html
#ElementDeclarationsConsistent


When wondering about the motivation for these constraints, I ended up
with
the following intention:

  The type of a child element E which may occur as a child of a parent
element
  PE shall not depend on ist position in the content [model].

If this is correct, then how about the following scenario:

<element name="PE" type="CT">

<complexType name="CT"/>

<complexType name="CT1"/>
  <extension base="CT">
    <sequence>
      <element name="E" type="E-type-1"/>
    </sequence>
    <attribute name="A" type="A-type-1"/>
  </extension>
<complexType>

<complexType name="CT2"/>
  <extension base="CT">
    <sequence>
      <element name="E" type="E-type-2"/>
    </sequence>
    <attribute name="A" type="A-type-2"/>
  </extension>
<complexType>
  
Then, when looking at the following two documents

<PE xsi:type="CT1" A="..."><E>...</E></PE>
<PE xsi:type="CT2" A="..."><E>...</E></PE>

Now E is once validated vs. "E-type-1", once vs "E-type-2",
similarly for A.

I wonder whether there should be a similar constraint to
"Element Declarations Consistent" demanding that
"E-type-1" is the same named type as "E-type-2",
the same for "A-type-1" and "A-type-2".
  
Best regards
Uli

Received on Wednesday, 16 March 2005 21:15:26 UTC