Re: Not a valid restriction of the content model problem

Your schema is valid per XSV [1].  However, XSV uses an experimental
implementation of restriction which the XML Schema WG is planning to
move to for XML Schema 1.1, so that's not definitive.

The validity of the derivation in question (AlphabetSoupType from
ContentType) turns on a fairly obscure point in XML Schema 1.0,
thrashed out on this list some years ago [2].

Bottom line -- XML Spy _should_ accept your schema, but it's a bug
other processors have shown before now that it doesn't.

You could _try_ the following (admittedly obnoxious) workaround:  
<xs:schema ...>
 <xs:import namespace="http://www.w3.org/2001/XMLSchema"/>

 . . .

 <xs:complexType name="ContentType">
  <xs:choice>
   <xs:element ref="xs:annotation"/> <!-- never happen -->
   <xs:any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded"/>
  </xs:choice>
  <xs:anyAttribute namespace="##local"/>
 </xs:complexType>

 <xs:complexType name="AlphabetSoupType">
  <xs:complexContent>
   <xs:restriction base="ContentType">
   <xs:choice>
    <xs:element ref="xs:annotation"/> <!-- never happen -->
     <xs:sequence>
      <xs:group ref="AOrBGroup"/>
      <xs:element ref="C" minOccurs="0"/>
      <xs:element ref="D"/>
     </xs:sequence>
    </xs:choice>
    <xs:attributeGroup ref="SizeAttributeGroup"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>

 . . .
</xs:schema>

Hope this helps,

ht

[1] http://www.ltg.ed.ac.uk/~ht/xsv-status.html
[2] http://lists.w3.org/Archives/Public/xmlschema-dev/2003Oct/0017.html
-- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Tuesday, 29 March 2005 09:50:14 UTC