Re: [xml] xmllint reports non-determinist content model for schema



FWIW, the schema looks OK to me and neither Visual Studio or the W3C's XSV seem to report an error, so it does look like a libxml2 bug.

And I can't think of another way of expressing what you want that isn't truly non-deterministic.

HTH a bit!

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info

----- Original Message ----- From: "Johan Corveleyn" <jcorvel gmail com>
To: <xml gnome org>
Sent: Friday, February 24, 2012 1:14 PM
Subject: [xml] xmllint reports non-determinist content model for schema


Hi,

This is my first post to this list. I searched the mailing list
archives and bugzilla, but couldn't find the exact issue I'm
confronted with (if I missed something, please point me to it).

I'm running into a "non-determinist" error with a schema even though I
don't think it's non-determinist (and both XSV and Xerces agree with
me; they too have no problem with the schema). I have reduced my
test-case to a simple example, see below.

Given the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="rules">
<xs:complexType>
<xs:sequence>
<xs:element name="rule" minOccurs="0" maxOccurs="unbounded"/>
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="specialRule" minOccurs="1" maxOccurs="1"/>
<xs:element name="rule" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

xmllint version 20708 complains with "Schemas parser error : local
complex type: The content model is not determinist."

The intention is to express that there can be any number of "rule"
elements, and there can be at most one "specialRule" (at any position
in between, before, or after the "rule"s). So the following xml's are
all valid:

<?xml version="1.0" encoding="UTF-8"?>
<rules>
<rule/>
<rule/>
<specialRule/>
<rule/>
</rules>

<?xml version="1.0" encoding="UTF-8"?>
<rules>
<specialRule/>
</rules>

<?xml version="1.0" encoding="UTF-8"?>
<rules>
<specialRule/>
<rule/>
<rule/>
<rule/>
</rules>

<?xml version="1.0" encoding="UTF-8"?>
<rules>
<rule/>
<rule/>
<rule/>
</rules>

But this one isn't (two specialRules):

<?xml version="1.0" encoding="UTF-8"?>
<rules>
<specialRule/>
<rule/>
<rule/>
<specialRule/>
<rule/>
</rules>



Is this a bug in libxml2?

And whether or not it's a bug: any workarounds? Can I write my schema
in another way to make xmllint succeed, and still express the same
constraints?

--
Johan
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]