W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2005

Re: Not a valid restriction of the content model problem

From: Henry S. Thompson <ht@inf.ed.ac.uk>
Date: Tue, 29 Mar 2005 10:50:09 +0100
To: "Wilde Rebecca L SSgt HQ SSG/SWO" <Rebecca.Wilde@Gunter.AF.mil>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5boed293xq.fsf@erasmus.inf.ed.ac.uk>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT