GNOME Bugzilla – Bug 321475
libxml2 claims a schema non-deterministic while all major XML libs accept it
Last modified: 2005-12-15 02:11:40 UTC
Please describe the problem: The following schema component is found correct (deterministic) by all these applications, yet libxml2 claims it is not: - The W3 online schema validator - Xerces - Altiva's XMLSpy - Microsoft Visual Studio (MSXML?) <xs:element name="animation"> <xs:complexType> <xs:sequence> <xs:element ref="asset" minOccurs="0"/> <xs:choice> <xs:sequence> <xs:element ref="source" maxOccurs="unbounded"/> <xs:choice> <xs:sequence> <xs:element ref="sampler" maxOccurs="unbounded"/> <xs:element ref="channel" maxOccurs="unbounded"/> <xs:element ref="animation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:element ref="animation" maxOccurs="unbounded"/> </xs:choice> </xs:sequence> <xs:sequence> <xs:element ref="sampler" maxOccurs="unbounded"/> <xs:element ref="channel" maxOccurs="unbounded"/> <xs:element ref="animation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:element ref="animation" maxOccurs="unbounded"/> </xs:choice> <xs:element ref="extra" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> <xs:attribute name="name" type="xs:NCName"/> </xs:complexType> </xs:element> Steps to reproduce: 1. Create an xmlSchemaParserCtxt xmlSchemaNewParserCtxt() 2. Call xmlSchemaParse() Actual results: xmlSchemaParse() errors out, claiming: "element complexType: Schemas parser error : local complex type: The content model is not determinist." By the way, the message has a typo. I believe term would be "deterministic". Expected results: xmlSchemaParse() should be successful and return a valid xmlSchema structure. Does this happen every time? Yes Other information:
it's not crashing, it's a normal bug, not a blocker. Can you provide a full complete schemas file reproducing the problem with xmllint ? So that xmllint --schemas pbm.xsd instance.xml allows to reproduce the problem. I cannot work with fractional data, sorry that would force guessing and I can't spend time making guess while you have the full informations. thanks, Daniel
Thank you very much for the quick response (I'm impressed :)). Yes, xmllint also gives the same error message. Here is a complete schema for you to reproduce the problem: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://www.collada.org/2005/11/COLLADASchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.collada.org/2005/11/COLLADASchema" elementFormDefault="qualified" version="1.4.0" xml:lang="EN" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"> <xs:element name="animation"> <xs:complexType> <xs:sequence> <xs:element ref="asset" minOccurs="0"/> <xs:choice> <xs:sequence> <xs:element ref="source" maxOccurs="unbounded"/> <xs:choice> <xs:sequence> <xs:element ref="sampler" maxOccurs="unbounded"/> <xs:element ref="channel" maxOccurs="unbounded"/> <xs:element ref="animation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:element ref="animation" maxOccurs="unbounded"/> </xs:choice> </xs:sequence> <xs:sequence> <xs:element ref="sampler" maxOccurs="unbounded"/> <xs:element ref="channel" maxOccurs="unbounded"/> <xs:element ref="animation" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:element ref="animation" maxOccurs="unbounded"/> </xs:choice> <xs:element ref="extra" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> <xs:attribute name="name" type="xs:NCName"/> </xs:complexType> </xs:element> <xs:element name="extra"/> <xs:element name="asset"/> <xs:element name="channel"/> <xs:element name="sampler"/> <xs:element name="source"/> <xs:element name="technique"/> </xs:schema> Thank you very much, Gabor
Okay, I managed to reproduce the problem, but I don't really have time right now to debug the problem, it's in bugzilla and I will try to look at this later this week if I find time. paphio:~/XML -> xmllint --schema sony.xsd tst.xml sony.xsd:4: element complexType: Schemas parser error : local complex type: The content model is not determinist. WXS schema sony.xsd failed to compile <?xml version="1.0"?> <doc/> paphio:~/XML -> thanks for the report, Daniel
Yesterday's fix of bug #323510, got also rid of the problem we have here. It's in CVS, xmlschemas.c revision 1.187. Thanks for the report!
It works, thank you for the fix.