[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
Re: UPA Question

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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.