GNOME Bugzilla – Bug 347316
Incorrect validation of W3C XML schema
Last modified: 2006-07-12 15:55:47 UTC
Please describe the problem: The xml document below is not validating correctly, I get the follow error: complex type 'pwdcontrol_type': The content type must specify a particle. With xerces-j the document is validated correctly. -----------XML document--------------- <?xml version="1.0" encoding="UTF-8"?> <policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="inheritance_test1.xsd"> <pwdcontrol min_chars="dgsd"> </pwdcontrol> </policy> ------------- XML SCHEMA ------------------ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="policy"> <xs:complexType> <xs:sequence> <xs:element ref="control" maxOccurs="unbounded"> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="control" abstract="true" type="control_type"> </xs:element> <xs:element name="loggingcontrol" type="loggingcontrol_type" substitutionGroup="control"> </xs:element> <xs:complexType name="control_type" abstract="true"> <xs:simpleContent> <xs:extension base="xs:string"> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="pwdcontrol_type"> <xs:complexContent> <xs:extension base="control_type"> <xs:attribute name="min_chars" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="loggingcontrol_type"> <xs:complexContent> <xs:extension base="control_type"> <xs:attribute use="required" name="logfile"> </xs:attribute> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="pwdcontrol" substitutionGroup="control" type="pwdcontrol_type"> </xs:element> </xs:schema> Steps to reproduce: 1. Put xml document above into a file 2. Put the schema in a file in the same directory named inheritance_test1.xsd 3. Validate using libxml2 Actual results: I get the error: complex type 'pwdcontrol_type': The content type must specify a particle. Expected results: Correct validation. Does this happen every time? Yes. Other information:
Fixed now in the CVS HEAD, xmlschemas.c, revision 1.204. In xmlSchemaFixupComplexType(), the simple type, which was the content type definition of a complex type, which in turn was the base type of a extending complex type, was missed to be set on this extending complex type in the derivation machinery. Thanks for the report!