Re: Question on abstract element

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
level.

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:sequence>
    <xs:element name="foo" type="fooType" />
  </xs:sequence>
</xs:group>

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

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

Cheers,

Jeni

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

Received on Wednesday, 10 April 2002 13:56:11 UTC