duplicated element names in content model

Hej,

the following schema
=========================================
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="doc" type="foo"/>
  <xsd:complexType name="foo">
    <xsd:sequence>
      <xsd:element name="e1" type="xsd:string"/>
        <xsd:choice>
          <xsd:choice>
            <xsd:element name="e1" type="xsd:integer"/>
          </xsd:choice>
        </xsd:choice>
      </xsd:sequence>
  </xsd:complexType>
</xsd:schema>
=========================================
is wrong according to the schema test suite and several validators.
But why exactly is it wrong? Does it violates the UPA constraint in some way?

When having a document

<doc>
  <e1/>
  <e1/>
</doc>

it seems to be possible to assign xsd:string to the first e1 and xsd:integer 
to the second, as both elements must appear at least once I can not see
any ambiguity here.
Is it explicitly stated somewhere in the schema spec or hidden inside an
algorithm?

Ciao,
Tobias

Received on Friday, 2 January 2009 15:09:39 UTC