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

Re: Question on abstract element

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 10 Apr 2002 18:55:55 +0100
Message-ID: <17728539925.20020410185555@jenitennison.com>
To: "Arnaud Blandin" <blandin@intalio.com>
CC: "Xmlschema-Dev" <xmlschema-dev@w3.org>
Hi Arnaud,

> The purpose of this schema is to prevent the element 'foo' from
> being used as a top-level element and only used when referenced
> inside a complexType or a group.
> The problem I have is: since 3.3.4 Element Declaration Validation
> Rules specifies that the 'abstract' attribute of a local element
> must be set to 'false', do I have to do it by hand (adding
> abstract='false' to the referenced element)or is it implied since I
> am using a 'ref'. I couldn't find any pointer in the spec.

The element must be *declared* as non-abstract. Making an element
abstract means that it can't be used in the instance document at any

I think that in your case, you could put the element declaration into
a group, and then reference the group. This will mean that the element
can't be used as the document element (or as the head element of a
substitution group), but enables you to refer to the same declaration
many times in your schema:

<xs:group name="fooGroup">
    <xs:element name="foo" type="fooType" />

<xs:element name="bar">
        <xs:group ref="fooGroup"/>

Alternatively, you could declare the element locally within the
complex type.



Jeni Tennison
Received on Wednesday, 10 April 2002 13:55:57 UTC

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