Re: [xml] xmllint reports non-determinist content model for schema
- From: "Pete Cordell" <petexmldev codalogic com>
- To: "Johan Corveleyn" <jcorvel gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] xmllint reports non-determinist content model for schema
- Date: Mon, 27 Feb 2012 12:17:43 -0000
I think it's fair to say that Daniel isn't a great fan is XML XSD Schema, so
I imagine it won't be fixed too quickly. I think libxml2's support for
Relax NG is better. It might be worth seeing if you can do what you want
with that. I've never tried it, but by all accounts Trang should be able to
give you a start at converting your XSD to Relax NG if your schema is
non-trivial.
HTH,
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: "Pete Cordell" <petexmldev codalogic com>
Cc: <xml gnome org>
Sent: Monday, February 27, 2012 8:29 AM
Subject: Re: [xml] xmllint reports non-determinist content model for schema
Thanks for confirming. That's already a big help :-).
Too bad that there is no other way to express this in XML Schema,
which works with xmllint.
I'll file an issue in the issue tracker, and hopefully someone will
find the time to fix this some day.
Cheers,
--
Johan
On Fri, Feb 24, 2012 at 2:58 PM, Pete Cordell <petexmldev codalogic com>
wrote:
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]