This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 11092 - Error in S4SD: complexType name="all" is not a valid restriction
Summary: Error in S4SD: complexType name="all" is not a valid restriction
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2010-10-19 13:30 UTC by Michael Kay
Modified: 2011-02-01 10:14 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2010-10-19 13:30:35 UTC
I'm getting the following error compiling the S4SD:

Error on line 906 of s4s11-2010-10-18.xsd:
  The content model of the complex type "all" is not a valid restriction of the content model of the type "explicitGroup". Definition of element "group" differs between the restricted type and the base type. Type of element in restricted content model is not derived by restriction from the type of the corresponding element in base content model.

In complexType name="all", the particle for element name="group" is defined within group name="allModel" like this:

        <xs:element name="group">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="xs:annotation" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="ref" type="xs:QName" use="required"/>
            <xs:attribute name="minOccurs" fixed="1" type="xs:nonNegativeInteger"/>
            <xs:attribute name="maxOccurs" fixed="1" type="xs:nonNegativeInteger"/>
            <xs:anyAttribute namespace="##other" processContents="lax"/>
          </xs:complexType>
        </xs:element>

wherease the base type (name="explicitGroup") defines it within group name="particle" like this:

<xs:element name="group" type="xs:groupRef"/>

This problem seems to have been introduced when we made the change to allow group references within xs:all.
Comment 1 David Ezell 2010-11-12 16:36:16 UTC
SG to attempt...
Comment 2 C. M. Sperberg-McQueen 2011-01-13 23:43:03 UTC
Proposed fix:  in the declaration for group xs:allModel, change the anonymous complex type for xs:group to use xs:groupRef as its base type, not (implicitly) xs:anyType.  The declarations for unchanged attributes (@ref, and the attribute wildcard) can also be dropped because the attributes will be inherited.  

So the declaration of the xs:group element will no longer read:

        <xs:element name="group">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="xs:annotation" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="ref" type="xs:QName" use="required"/>
            <xs:attribute name="minOccurs" fixed="1" type="xs:nonNegativeInteger"/>
            <xs:attribute name="maxOccurs" fixed="1" type="xs:nonNegativeInteger"/>
            <xs:anyAttribute namespace="##other" processContents="lax"/>
          </xs:complexType>
        </xs:element>

but instead:

        <xs:element name="group">
          <xs:complexType>
	    <xs:complexContent>
	      <xs:restriction base="xs:groupRef"> 
		<xs:sequence>
		  <xs:element ref="xs:annotation" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="minOccurs" fixed="1" type="xs:nonNegativeInteger"/>
		<xs:attribute name="maxOccurs" fixed="1" type="xs:nonNegativeInteger"/>
	      </xs:restriction>
	    </xs:complexContent>
	  </xs:complexType> 
        </xs:element>

I can confirm that Saxon stops complaining about this problem when this change is made.
Comment 3 C. M. Sperberg-McQueen 2011-01-28 17:37:27 UTC
On 28 January 2011 the WG approved the change proposal in comment 2.
Comment 4 C. M. Sperberg-McQueen 2011-01-31 23:06:02 UTC
The change described in comment 2 has now been integrated into the status-quo documents pointed to from the editorial pointers page at http://www.w3.org/XML/Group/2004/06/xsd-ed-pointers.html (member-only link).  Accordingly, I'm marking the bug resolved.

Michael, if you would verify that the change has been made and then close the bug, it would be helpful.