UPA — (Why) Is There a Difference Between Those Two?

Hello, 

I wanted to make sure that I understand this rule correctly. 

Foo defined in the following way will result in error in both 
MSXML and libxml2:

  <xs:element name="non-valid-foo">
    <xs:complexType>
      <xs:sequence>
        <xs:sequence>
          <xs:element name="bar" minOccurs="2" maxOccurs="5"/>
          <xs:element name="xyz" minOccurs="0"/>
        </xs:sequence>
        <xs:sequence>
   <!-- bar is ambiguous -->
          <xs:element name="bar" minOccurs="2" maxOccurs="5"/>
          <xs:element name="xyz" minOccurs="0"/>
        </xs:sequence>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

However both parsers have no problem with foo defined in a following way:

  <xs:element name="valid-foo">
    <xs:complexType>
      <xs:sequence minOccurs="2" maxOccurs="2">
        <xs:element name="bar" minOccurs="2" maxOccurs="5"/>
        <xs:element name="xyz" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

I understand that XML Schema only mentions that *two* adjacent particles can 
overlap:

> A content model will violate the unique attribution constraint if it 
contains *two* particles which ·overlap· and which either (…)

On the other hand, I could easily imagine that it would be possible to convert 
the 1st form into the 2nd one in a preprocessing step during compilation of 
schema. 

Is my understanding of this principle correct? I.e. if particles are implicit 
is certain ambiguity allowed? Why first example validates differently than the 
2nd one?

Sincerely,
Denis Zawada

Received on Thursday, 23 June 2011 21:26:21 UTC