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

XSV choice validation

From: Vaughan, Dallas <VAUGHAN@scra.org>
Date: Wed, 2 Nov 2005 07:00:49 -0500
Message-ID: <03642EC064085F4DBB3B40DB5D82F2A2633B83@SCRA_NT1.SCRA.ORG>
To: <xmlschema-dev@w3.org>
Cc: "Vaughan, Dallas" <VAUGHAN@scra.org>
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 12:19:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:51 GMT