GNOME Bugzilla – Bug 573483
xmllint complains that content model is not deterministic when using ‘choice’ with ‘any’ and ‘namespace’s ‘##other’ *and* ‘##local’ in XML Schema document
Last modified: 2019-09-16 14:36:56 UTC
Using xmllint from libxml2-2.7.3 as follows results in an error. -----BEGIN test.xml----- <?xml version="1.0" encoding="UTF-8"?> <test xmlns="http://example.org/xmllint-xsd-test-n-roeser-1a#" xmlns:testing="http://example.org/xmllint-xsd-test-n-roeser-1b#"> <hello/> <testing:world/> </test> -----END test.xml----- -----BEGIN test-schema.xml----- <?xml version="1.0" encoding="UTF-8"?> <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/xmllint-xsd-test-n-roeser-1a#" xmlns="http://example.org/xmllint-xsd-test-n-roeser-1a#" elementFormDefault="qualified"> <s:element name="test"> <s:complexType> <s:choice minOccurs="1" maxOccurs="3"> <s:any namespace="##local"/> <s:any namespace="##other"/> </s:choice> </s:complexType> </s:element> </s:schema> -----END test.xsd----- $ xmllint --nonet --noout --schema test-schema.xml test.xml test-schema.xml:7: element complexType: Schemas parser error : local complex type: The content model is not determinist. WXS schema test-schema.xml failed to compile This looks very much like the problem described in <URL:http://xsd.stylusstudio.com/2006May/post04004.htm> to me. By the way: options for version 2.7.2 and 2.7.3 are missing in GNOME Bugzilla for product libxml2. Please add them. Thanks.
I observed the same problem in the schema description of CML that uses the same constructs. Discussions with the developers of CML, lxml and the saxon parser tracked the problem down to the above mentioned namespace problems in the libxml2. A fix would be great as this bug renders the usage of python for the validation of the CML xsd impossible.
Fixed here: https://github.com/nwellnhof/libxml2/commit/e8c9cd5c7a0d2ea95edf08b13af3baabce62dd63