After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 167754 - Schema: xsd:all combined with xsd:element ref="..." is rejected
Schema: xsd:all combined with xsd:element ref="..." is rejected
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.17
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-02-17 23:10 UTC by Frans Englich
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Frans Englich 2005-02-17 23:10:42 UTC
Please describe the problem:
  
Hello,  
  
For the following schema:  
  
<?xml version="1.0" encoding="UTF-8" ?>  
<xsd:schema  
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
        xmlns:target="http://www.example.com/Test"  
        targetNamespace="http://www.example.com/Test"  
        version="1.0"  
        elementFormDefault="qualified" >  
  
  
        <xsd:element name="foo" />  
        <xsd:element name="bar" />  
        <xsd:element name="joe" />  
  
        <xsd:complexType name="dominik">  
                <xsd:all>  
                        <xsd:element minOccurs="0" ref="target:foo" />  
                        <xsd:element minOccurs="0" ref="target:bar" />  
                        <xsd:element minOccurs="0" ref="target:joe" />  
                </xsd:all>  
        </xsd:complexType>  
  
        <xsd:element name="test">  
                <xsd:complexType>  
                        <xsd:sequence>  
                                <xsd:element maxOccurs="unbounded" name="child"  
type="target:dominik" />  
                        </xsd:sequence>  
                </xsd:complexType>  
        </xsd:element>  
  
</xsd:schema>  
  
and the document: 
 
<test xmlns="http://www.example.com/Test"> 
        <child> 
                <foo/> 
        </child> 
        <child> 
                <foo/> 
                <joe/> 
        </child> 
</test> 
 
 
is the message: 
 
bash-2.05b$ xmllint --noout --schema test.xsd test.xml 
test.xml:2: element child: Schemas validity error : Element 'child' [complex 
type 'dominik']: Missing child element(s). Expected is ( #eRef 2 ). 
test.xml:7: element joe: Schemas validity error : Element 'joe': This element 
is not expected. 
test.xml fails to validate 
 
This is with libxml2 2.6.17. The document validates fine with Microsoft's: 
http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx 
 
If the above example is changed into: 
 
                <xsd:all>  
                        <xsd:element minOccurs="0" name="foo" />  
                        <xsd:element minOccurs="0" name="bar" />  
                        <xsd:element minOccurs="0" name="joe" />  
                </xsd:all>  
 
it works in libxml2. To me, it looks like libxml2 reject a valid Schema. 
 
 
Cheers, 
Frans 
 

Steps to reproduce:
 

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 kbuchcik 2005-02-18 11:56:46 UTC
Fixed in CVS (xmlschemas.c rev. 1.110).
The content model automaton was built with the element declaration, and - 
incorrectly - with the reference to it. Seems to have been a side affect of a 
previous bug fix.

I added your test case to the regression tests.

Thanks for the report Frans!
Comment 2 Daniel Veillard 2005-09-05 08:59:42 UTC
This should be closed by release of libxml2-2.6.21,

  thanks,

Daniel