Re: Restricting substitution groups?

Eric,

My take on this is that it is OK.

The table shown under Particle Valid: Restriction could be said to be
misleading as it forbids base of element and derived of choice. Perhaps one
way of thinking about it is that the element ref is in fact a ref to a
choice group rather than an element decl and hence corresponds to a choice
particle. However, I agree that Clause 2 of RecurseLax[1] is problematic in
this case.

Sounds to me like the easiest fix is to say, when the choice your
restricting is in fact a synthetic choice due to a substitution group then
the order rule does not apply.

I note that Xerces 1.4.4 and MSXML 4.0 both deal with your schema ( and
instance crufted up by me ) perfectly well.

Gudge

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

----- Original Message -----
From: "Eric van der Vlist" <vdv@dyomedea.com>
To: <xmlschema-dev@w3.org>
Sent: Thursday, December 06, 2001 4:38 PM
Subject: Restricting substitution groups?


> Given that a substitution group is kind of equivalent to xs:choice:
>
> http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict
>
>
> 2.1 Any top-level element declaration particle (in R or B) which is the
> {substitution group affiliation} of one or more other element
> declarations is treated as if it were a choice group whose {min occurs}
> and {max occurs} are those of the particle, and whose {particles}
> consists of one particle with {min occurs} and {max occurs} of 1 for the
> top-level element declaration and for each of the declarations in its
> ·substitution group·.
>
> Does that mean that we can restrict substitution groups?
>
> If for instance I have:
>
> <xs:element name="head"/>
> <xs:element name="a" substitutionGroup="head"/>
> <xs:element name="b" substitutionGroup="head"/>
> <xs:element name="c" substitutionGroup="head"/>
>
> and:
>
> <xs:complexType name="base">
>   <xs:sequence>
>     <xs:element ref="head"/>
>   </xs:sequence>
> </xs:complexType>
>
> is
>
> <xs:complexType name="derived">
>   <xs:complexContent>
>    <xs:restriction base="base">
>     <xs:sequence>
>       <xs:choice>
>         <xs:element ref="a"/>
>         <xs:element ref="b"/>
>       </xs:choice>
>     </xs:sequence>
>    </xs:restriction>
>   </xs:complexContent>
> </xs:complexType>
>
> a valid restriction?
>
> I guess not since it doesn't seem to match the condition for restricting
> choices:
>
> Schema Component Constraint: Particle Derivation OK (Choice:Choice --
> RecurseLax)
> For a choice group particle to be a ·valid restriction· of another
> choice group particle 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 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).
> NOTE: Although the ·validation· semantics of a choice group does not
> depend on the order of its particles, derived choice groups are required
> to match the order of their base in order to simplify checking that the
> derivation is OK.
>
> The question should then probably be which is the order of the elements
> of a substitution group when they are mapped to a xs:choice during
> validation (and how can this be used to restrict a substitution group) ?
>
> Thanks
>
> Eric
> --
> See you in Orlando for XML 2001.
>                                      http://www.xmlconference.net/xmlusa/
> ------------------------------------------------------------------------
> Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
> http://xsltunit.org      http://4xt.org           http://examplotron.org
> ------------------------------------------------------------------------
>

Received on Thursday, 7 February 2002 05:47:41 UTC