all groups: top level only?

We had the impression that all groups can only occur at the top level of a
content model.  This appears to be incorrect.  I'd like to ask about two
cases.

[BTW - Thanks to Henry for his last answer.]

Case 1.  Extending an all group with another element in sequence after it.
We believe that we read the spec as saying that this is illegal by clause 1
of [1].  Indeed, SQC says that it is bad for exactly that reason.  However,
XSV says that it is a legal schema.

 <xsd:complexType name='allType' >
  <xsd:all>
   <xsd:element name='a' />
   <xsd:element name='b' />
   <xsd:element name='c' />
  </xsd:all >
 </xsd:complexType>

 <xsd:element name='extensionElement' >
  <xsd:complexType>
   <xsd:complexContent>
    <xsd:extension base='allType' >
     <xsd:sequence>
      <xsd:element name='d' />
     </xsd:sequence>
    </xsd:extension>
   </xsd:complexContent >
  </xsd:complexType>
 </xsd:element>


Case 2.  This time much the same content model is produced (All(a,b,c), d),
but with an xsd:group, which the spec seems to allow via clause 1.1 of [1]
(at least we're not sure how else to understand that.)  Indeed, both XSV
and SQC permit it.  So why do we ask about this case if the spec and all
processors seem to agree?  Because the spec and all processors also agree
that the trivial writing of the content model (All(a,b,c), d) is illegal.
And we thought that moving a sub-content model into an xsd:group shouldn't
ever change the legality of the schema [2], which is no longer true.  Thus,
we wanted to be sure.

 <xsd:group name='allGroup' >
  <xsd:all>
   <xsd:element name='a' />
   <xsd:element name='b' />
   <xsd:element name='c' />
  </xsd:all>
 </xsd:group>

 <xsd:element name='seqElement' >
  <xsd:complexType>
   <xsd:sequence>
    <xsd:group ref='allGroup' />
    <xsd:element name="d" />
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>


Summary:  Sequence(All(a,b,c), d)

         inlined      derived by     referenced as
         in full      extension      xsd:group
         -------      ----------     -------------
XSV        bad           ok             ok
SQC        bad           bad            ok

[1] http://www.w3.org/TR/xmlschema-1/#cos-all-limited
[2] http://www.w3.org/TR/xmlschema-1/#Model_Group_Definition_details
    says "Model group definitions per se do not participate in validation"

Received on Thursday, 5 December 2002 17:35:20 UTC