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

Re: Restricting a substitution group using <choice>

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 15 Mar 2002 09:53:37 +0000
Message-ID: <52178562909.20020315095337@jenitennison.com>
To: Simon.Cox@csiro.au
CC: dareo@microsoft.com, xmlschema-dev@w3.org
Hi Simon,

> But not all of them: here is another example that seems to me
> /should/ work but MSXML just will not pass - I use a <sequence> of
> two <choice> groups to restrict a substitution group whose
> maxOccurs="unbounded". MSXML insists "Invalid particle derivation by
> restriction".

The relevant types are:

>   <xs:complexType name="ValueCollectionType">
>     <xs:sequence>
>       <xs:element ref="my:valueMember" minOccurs="0" maxOccurs="unbounded"/>
>     </xs:sequence>
>   </xs:complexType>
> <!-- -->
>   <xs:complexType name="ValueRangeType">
>     <xs:complexContent>
>       <xs:restriction base="my:ValueCollectionType">
>         <xs:sequence>
>           <xs:choice>
>             <xs:element ref="my:lowerExclusive"/>
>             <xs:element ref="my:lowerInclusive"/>
>           </xs:choice>
>           <xs:choice>
>             <xs:element ref="my:upperInclusive"/>
>             <xs:element ref="my:upperExclusive"/>
>           </xs:choice>
>         </xs:sequence>
>       </xs:restriction>
>     </xs:complexContent>
>   </xs:complexType>

The content model of the first type is mapped to:

  <xs:sequence>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="my:valueMember" />
      <xs:element ref="my:lowerExclusive" />
      <xs:element ref="my:lowerInclusive" />
      <xs:element ref="my:upperInclusive" />
      <xs:element ref="my:upperExclusive" />
    </xs:choice>
  </xs:sequence>

I can't find a route through the Particle Valid (Restriction) rules at
http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict that enables
you to restrict one choice into two choices, though I'd love to be
corrected because intuitively it seems like something you should be
able to do. I also can't find a way around it right now.

For the record, Xerces-C++ accepts the schema, but Xerces-J complains
that there's no functional mapping between the components under the
rcase-MapAndSum.1 rule (which at least tells you what the problem is!).

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Friday, 15 March 2002 04:53:44 GMT

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