Re: Is this valid?

Hi Dare,

> I thought that but would like to know if the REC allows it given the
> rules in
>
> http://www.w3.org/TR/xmlschema-1/#rcase-RecurseAsIfGroup
> and
> http://www.w3.org/TR/xmlschema-1/#rcase-Recurse
>
> Specifically can 
>
>   <xs:sequence minOccurs="0">
>                     <xs:element name="a1"/>
>                     <xs:element name="b1"/>
>    </xs:sequence>
>
> be restricted to 
>
>  <xs:element name="b1"/>
>
> given the wording [not intentions] of the REC? 

When you do a restriction from a sequence to an element particle, you
treat the element particle as if it were a sequence, so you then have
to look at the "Recurse" rule for mapping sequences to sequences:

  For an all or sequence group particle to be a �valid restriction� of
  another group particle with the same {compositor} all of the
  following must be true:

  1 R's occurrence range is a valid restriction of B's occurrence
    range as defined by Occurrence Range OK (�3.9.6).

  2 There is a complete �order-preserving� functional mapping from
    the particles in the {particles} of R to the particles in the
    {particles} of B such that all of the following must be true:

    2.1 Each particle in the {particles} of R is a �valid
        restriction� of the particle in the {particles} of B it maps
        to as defined by Particle Valid (Restriction) (�3.9.6).

    2.2 All particles in the {particles} of B which are not mapped
        to by any particle in the {particles} of R are �emptiable� as
        defined by Particle Emptiable (�3.9.6).

The crux is #2. You're asking whether, given:

  (a1, b1)?  ->  (b1)

there's a complete order-preserving functional mapping from a1 and b1
to b1. The answer is that there isn't. There are various possible
mappings, all of which fall foul of #2. The best map is:

  a1  ->  nothing
  b1  ->  b1

and #2.2 says that if a particle in the base doesn't map on to
anything (as a1 doesn't) then it must be emptiable. Emptiable means:

  [Definition:] For a particle to be emptiable one of the following
  must be true:
  1 Its {min occurs} is 0.
  2 Its {term} is a group and the minimum part of the effective
    total range of that group, as defined by Effective Total Range
    (all and sequence) (�3.8.6) (if the group is all or sequence) or
    Effective Total Range (choice) (�3.8.6) (if it is choice), is 0.

                 http://www.w3.org/TR/xmlschema-1/#cos-group-emptiable

and neither of those cases is true (the min occurs for the particle a1
is 1, and it isn't a group, it's an element particle).

Do you read it differently?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Monday, 22 July 2002 14:12:12 UTC