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

Problems with xs:complexType restriction involving xs:choice

From: Dare Obasanjo <kpako@yahoo.com>
Date: Wed, 9 Jan 2002 13:09:51 -0800
Message-ID: <00c101c19951$fb636380$0500a8c0@carnage>
To: <xmlschema-dev@w3.org>
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?

I assume the relevant parts of the XML Schema: Structures recommendation is
section

    3.4.6 (Constraints on Complex Type Definition Schema Components)
and
    Schema Component Constraint: Particle Valid (Restriction) [0]
and
    Schema Component Constraint: Particle Derivation OK (Choice:Choice --
RecurseLax) [1]

but it wasn't readily obvious if there was any problem with the schema
_except_  if the part 2 of the (Choice:Choice -- RecurseLax) section mentioned
above requires that for each particle in the Base type,B, there must be a
corresponding particle in the Derived type, D.

[0] http://www.w3.org/TR/xmlschema-1/#cd-model-restriction
[1] http://www.w3.org/TR/xmlschema-1/#rcase-RecurseLax

<xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:phx="urn:foo"
  targetNamespace="urn:foo">
<xs:element name="Manifest" type="xs:string" />
<xs:element name="Shipment" type="xs:string" />
<xs:element name="Package" type="xs:string" />
<xs:simpleType name="CarrierSpecialService_t">
        <xs:restriction base="xs:positiveInteger">
         <xs:maxExclusive value="100"/>
        </xs:restriction>
       </xs:simpleType>
  <xs:simpleType name="Carrier_t">
        <xs:restriction base="xs:positiveInteger">
         <xs:maxExclusive value="100"/>
        </xs:restriction>
       </xs:simpleType>

<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>

--
THINGS TO DO IF I BECOME AN EVIL OVERLORD #71
If I decide to test a lieutenant's loyalty and see if he/she should be made
a trusted lieutenant, I will have a crack squad of marksmen standing by
in case the answer is no.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Received on Wednesday, 9 January 2002 13:10:46 GMT

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