Bug 924785
| Summary: | xmllint considers schema content model not determinist, although it is deterministic | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Colin Guthrie <colin> |
| Component: | libxml2 | Assignee: | Daniel Veillard <veillard> |
| Status: | CLOSED DUPLICATE | QA Contact: | qe-baseos-tools-bugs |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 5.9 | CC: | joey.cai, ohudlick, slukasik, tcarter |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-06-04 13:14:09 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Colin Guthrie
2013-03-22 13:51:27 UTC
Just for clarity (this info is on the gnome bug) Test case: Create a schema with the following content: <?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> Validate it with: xmllint --schema foo.xsd It will print out usage info, but ignore that, just look at the errors above the usage which will state: $ xmllint --schema foo.xsd foo.xsd:4: element complexType: Schemas parser error : local complex type: The content model is not determinist. WXS schema foo.xsd failed to compile However further testing would suggest it's not actually a regression with the above commit *in this particular test case*, but does fail on others!! I will attempt to get a valid test case to you that highlights the before/after problems better... OK, the following schema appears to show a difference for me before and after the update: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foobar.org/wibble" elementFormDefault="qualified"> <xs:element name="foo"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="bar" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="wibble" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:choice> <xs:attribute name="version" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:schema> Before: $ xmllint --schema test.xsd 2>&1 | head -n 4 Usage : xmllint [options] XMLfiles ... Parse the XML files and output the result of the parsing --version : display the version of the XML library used --debug : dump a debug tree of the in-memory document After: $ xmllint --schema test.xsd 2>&1 | head -n 4 test.xsd:6: element complexType: Schemas parser error : local complex type: The content model is not determinist. WXS schema test.xsd failed to compile Usage : xmllint [options] XMLfiles ... Parse the XML files and output the result of the parsing I suspect that this is the same as Bug #922450. This is indeed the same bug, applying the 2 patches indicated in Bug #922450 fixes the problem: thinkpad:~/XML -> ./xmllint --schema 924785.xsd --noout foo.xml foo.xml validates thinkpad:~/XML -> cat 924785.xsd <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foobar.org/wibble" elementFormDefault="qualified"> <xs:element name="foo"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="bar" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="wibble" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:choice> <xs:attribute name="version" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:schema> thinkpad:~/XML -> cat foo.xml <foo xmlns="http://foobar.org/wibble" version="1"/> thinkpad:~/XML -> Daniel *** This bug has been marked as a duplicate of bug 922450 *** What is going on with this one? I tried to find more information of Bug #922450, but it told me I am not authorized to access it. An update fixing it will be pushed soon. Daniel |