W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Re: Problems with xs:complexType restriction involving xs:choice

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 10 Jan 2002 09:40:01 +0000
To: "Dare Obasanjo" <kpako@yahoo.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5b3d1e5ytq.fsf@cogsci.ed.ac.uk>
"Dare Obasanjo" <kpako@yahoo.com> writes:

> The attached schema gives the following  error
>     ERROR: Invalid particle derivation by restriction.
> when validated with MSFT .NET's XmlValidatingReader but works fine with XSV
> (and XML Spy). So is there a bug in the .NET XmlValidatingReader or is the
> derivation invalid?


> <xs:complexType name="RequestPayload_t">
>     <xs:choice maxOccurs="unbounded">
>         <xs:element ref="phx:Manifest" minOccurs="0"/>
>         <xs:element ref="phx:Shipment" minOccurs="0"/>
>         <xs:element ref="phx:Package" minOccurs="0"/>
>         <xs:element name="CarrierSpSvc" type="phx:CarrierSpecialService_t"
> minOccurs="0"/>
>         <xs:element name="Carrier" type="phx:Carrier_t" minOccurs="0"/>
>     </xs:choice>
> </xs:complexType>
> <xs:complexType name="storeShipmentPayload_t">
>     <xs:complexContent>
>         <xs:restriction base="phx:RequestPayload_t">
>         <xs:choice maxOccurs="unbounded">  <! -- ERROR OCCURS HERE -->
>             <xs:element ref="phx:Shipment" maxOccurs="unbounded"/>
>         </xs:choice>
>     </xs:restriction>
> </xs:complexContent>
> </xs:complexType>
> </xs:schema>

As the REC stands, MSFT is right and XSV is wrong, this is broken
(although not at the line you indicate, but rather the next line).

The base has xs:choice max=unbounded, and so does the derived type def.
The base has three alternatives in the choice, the derived type def
has only one.
The base alternatives are optional, the remaining alternative in the
derived type def is required

All of those are cool.

_But_, the base alternatives have (by default) max of 1, where the
remaining alternative in the derived type def has unbounded max --
this is not allowed by the REC.

However since in fact the _language_ accepted by the derived type def
_is_ a strict subset of the language accepted by the base, XSV
doesn't complain, since it only approximates the checking mandated by
the REC for valid restriction.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 10 January 2002 04:40:05 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:54 UTC