Re: Restricting a substitution group using <choice>

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 UTC