W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2011

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

From: Denis Zawada <deno@deno.pl>
Date: Thu, 23 Jun 2011 23:25:29 +0200
To: xmlschema-dev@w3.org
Message-Id: <201106232325.32187.deno@deno.pl>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 23 June 2011 21:26:22 GMT