Re: 'all' within 'complexContent' -- which parser is correct?

Hi,

>Hi!
>
>Here is a schema:
>
><?xml version="1.0" encoding="UTF-8"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>  <xs:complexType name="BaseParent">
>    <xs:sequence>
>      <xs:element name="child1"/>
>    </xs:sequence>
>  </xs:complexType>
>  <xs:element name="parent">
>    <xs:complexType>
>      <xs:complexContent>
>        <xs:extension base = "BaseParent">
>
>          <!-- XERCES's SAXParser reports error here-->
>          <xs:all>
>            <xs:element name="child2"/>
>          </xs:all>
>          
>        </xs:extension>
>      </xs:complexContent>
>    </xs:complexType>
>  </xs:element>
></xs:schema>
>
>XMLSpy5 and MSXML4 loaded it successfully but
>XERCES-C++ failed with error: "An 'all' model group that's part of
>a complex type definition must constitute the entire content type of
>the definition" :-(
>
>Who's right?
>
Xerces is correct and the others wrong. The <xs:all> group is very 
restrictive in the way it can be used because it must always be the 
*single* child of the type definition. Since a derivation by extension 
always creates the new type by "sequencing" together the content in the 
base type with the content in the derived type you can *never* use 
<xs:all> as part of an extension.

Cheers,
/Eddie

>
>thanks in advance.
>
>
>
>  
>

Received on Wednesday, 30 October 2002 17:33:53 UTC