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

Re: Question about Final Attributes on Elements

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 4 Jan 2002 11:59:46 +0000
Message-ID: <1861559007.20020104115946@jenitennison.com>
To: Niko Suave <niko@alum.mit.edu>
CC: xmlschema-dev@w3.org
Hi Niko,

> On an element, however, it's less clear to me. The valid values of
> block are "substitution", "restriction", and "extension." Obviously,
> "substitution" prevents substitution groups from operating on this
> element. I assume you can use this either on the actual def'n of the
> global element, or on a particular instance where it is referenced.
> If the element's block specifies "restriction" or "extension," then
> I would guess that this is equivalent to the type specifying the
> same block value except that it only applies to this instance of the
> type.


  - 'substitution' prevents users from substituting members of the
    substitution group of the element for the element itself in the
    instance document.

  - 'restriction' and 'extension' prevents users from using xsi:type
    on instances of the element to change the type of the element in
    the instance document.

> Okay, now we come to an element specifying "final". The only valid
> values for this are "substitution" and "restriction" --- but I have
> no idea what this means. You can't derive from an element as far as
> I know, only from a type, so I'm confused what final might be
> restricting.

The valid values are "extension" and "restriction" (where did you get
"substitution" from? the Rec should be corrected if you found it

This is about what elements you can declare to be members of the
substitution group of which the element is the head. Without any
'final', if you have:

<xs:element name="foo" type="xs:decimal" />

then you can happily have:

<xs:element name="bar" type="xs:integer" substitutionGroup="foo" />

This means that whenever the foo element occurs in a model group, you
can substitute in the bar element instead (the bar element is a member
of the foo element's substitution group; the foo element is the head
element of the substitution group). In a substitution group, the types
of the member elements must be derived from the type of the head

If you did:

<xs:element name="foo" type="xs:decimal" final="restriction" />

then the above declaration for the bar element would be invalid
because the final of 'restriction' prevents you from having members of
the substitution group whose type is derived by restriction from the
type of the head element.

Similarly, if you had a final of 'extension' then you couldn't declare
elements to be part of the substitution group if their types were
extensions of the type of the head element.

I hope that clarifies things for you.



Jeni Tennison
Received on Friday, 4 January 2002 06:59:49 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:54 UTC