RE: XSV choice validation

FYI, Saxon considers this schema valid.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Vaughan, Dallas
Sent: 02 November 2005 12:01
To: xmlschema-dev@w3.org
Cc: Vaughan, Dallas
Subject: XSV choice validation 



Hi,
When using the online XSV tool at http://www.w3.org/2001/03/webdata/xsv, the
following schema did not pass because of a "non-deterministic content model"
within the choice element.  Here is what didn't pass:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="root">
    <xs:complexType>
          <xs:choice>
            <xs:sequence>
                  <xs:element name="A" type="xs:string" maxOccurs="5"/>
                  <xs:element name="B" type="xs:string" minOccurs="0"/>
                  <xs:element name="C" type="xs:string" minOccurs="0"/>
            </xs:sequence>
            <xs:sequence>
                  <xs:element name="B" type="xs:string"/>
                  <xs:element name="C" type="xs:string" minOccurs="0"/>
            </xs:sequence>
            <xs:sequence>
                  <xs:element name="C" type="xs:string"/>
            </xs:sequence> 
          </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

The output from XSV was:

"Invalid: non-deterministic content model for type None: {None}:B/{None}:B"

However, changing the maxOccurs="5" in the first element ("A") to
maxOccurs="1" results in a successful validation. 

It should not matter that the maxOccurs is greater than 1, since, in that
case, all occurences would be in sequence.  There is no ambiguity here,
since the initial element is ALWAYS mandatory in each sequence within the
choice, so there is one and only one sequence that can be used for a given
initial element (if there is an initial "A" element, the first sequence HAS
to be used, since "A" does not appear within any other sequences).  Also,
this was deemed valid by XMLSpy's schema validator (which correctly
validates other instances of non-deterministic content). 

Is there a faulty algorithm in XSV that decides what is non-deterministic
and what is not?

Thank you,

Dallas Vaughan

Received on Wednesday, 2 November 2005 13:21:32 UTC