W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2006

Re: UPA Question

From: Boris Kolpackov <boris@codesynthesis.com>
Date: Tue, 28 Nov 2006 08:03:23 +0200
To: Erik Johnson <ejohnson@epicor.com>
Cc: xmlschema-dev@w3.org
Message-ID: <20061128060323.GA10139@karelia>

Hi Erik,

Erik Johnson <ejohnson@epicor.com> writes:


> But after thinking about it, I don't think that the content model is
> ambiguous.

It helps to remove all the syntactic sugar to the see the problem clearly:


<xs:element name="ElementC1">
  <xs:complexType>
    <xs:sequence>
      <xs:choice>
        <xs:choice>
          <xs:element name="ElementB1" />
          <xs:sequence>
            <xs:element name="ElementA1"/>
          </xs:sequence>
        </xs:choice>
        <xs:sequence>
          <xs:element name="ElementA1"/>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
</xs:element>

We can further simplify this schema fragment by replacing

<xs:sequence>
  <xs:element name="ElementA1"/>
</xs:sequence>

with just

<xs:element name="ElementA1"/>

which gives us:


<xs:element name="ElementC1">
  <xs:complexType>
    <xs:sequence>
      <xs:choice>
        <xs:choice>
          <xs:element name="ElementB1" />
          <xs:element name="ElementA1"/>      <!-- (1) -->
        </xs:choice>
        <xs:element name="ElementA1"/>        <!-- (2) -->
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
</xs:element>


Now when parser sees ElementA1 inside ElementC1 it has to ways of
associating a schema declarations to ElementA1: it can be ElementA1
from line (1) or it can be ElementA1 from line (2). Thus this schema
is ambiguous.


hth,
-boris


-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
Received on Tuesday, 28 November 2006 06:14:49 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC