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

Re: block="substitution" in local element definitions

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 19 Feb 2002 12:33:29 +0000
Message-ID: <1671187757.20020219123329@jenitennison.com>
To: Simon.Cox@csiro.au
CC: vdv@dyomedea.com, xmlschema-dev@w3.org
Hi Simon,

> But in Structures it says at [2]
>
> "[Definition:] Through the new mechanism of element substitution
> groups, XML Schemas provides a more powerful model supporting
> substitution of one named element for another. Any top-level element
> declaration can serve as the defining element, or head, for an
> element substitution group. Other *top-level* element declarations,
> regardless of target namespace, can be designated as members of the
> substitution group headed by this element. "
>
> Is this the normative restriction in the spec? I cannot find any
> other reference requiring substitutionGroup members or heads to be
> global/top-level ...

I think that this is a normative restriction in the spec. Substitution
groups are actually defined as follows:

  Schema Component Constraint: Substitution Group

  [Definition:] Every element declaration in the {element
  declarations} of a schema defines a substitution group, a subset of
  those {element declarations}, as follows:
  1 The element declaration itself is in the group;
  2 The group is closed with respect to {substitution group
    affiliation}, that is, if any element declaration in the {element
    declarations} has a {substitution group affiliation} in the group,
    then it is also in the group itself.
                     http://www.w3.org/TR/xmlschema-1/#cos-equiv-class
    
What's relevant here is that the substitution group is made up of
a subset of element declarations from the {element declarations} of
the schema. The {element declarations} of the schema are defined as:

  A set of named (top-level) element declarations.
                http://www.w3.org/TR/xmlschema-1/#element_declarations

So substitution groups can only contain global element declarations.

This is backed up by the fact that the schema for schemas only allows
substitutionGroup attributes on top-level element declarations, not on
local element declarations. The head of the substitution group must be
a global element declaration; otherwise it would be impossible for the
schema validator to locate it when it's referred to through the
substitutionGroup attribute.

I hope that clarifies things for you,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 19 February 2002 07:33:36 GMT

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