W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2001

How to specify particular attributes on any element?

From: Milton Taylor <mctaylor@ingennia.com.au>
Date: Sun, 1 Jul 2001 01:20:11 -0400 (EDT)
Message-ID: <3B3EB276.DF19A759@ingennia.com.au>
To: xmlschema-dev@w3.org
I was wondering how I might easily specify (in a schema) that any
elements - including any child elements - might contain 'common'
attributes from a particular set of attributes. For example, I might
want to have an attribute "private" on any element to indicate that that
data should not be made available to the general public.

I guess I can see how this could be done by brute force - i.e.
explicitly using an attribute group reference in every element
definition, but where this gets messy is that I would have many elements
that use built-in simple datatypes, so simple elements almost all become
complex elements straight away.

The most generic,  brute force method I can think of  would require
subclassing each built-in type into an equivalent  complex type that
contained the desired attribute group reference, and then deriving from
these rather than from the standard types. Putting these new types in
another namespace would clearly be a good idea.

A more application specific-method  adds the attribute references at the
lowest level of the application schema's component elements, but a lot
of these elements immediately become complex elements [by extension]
rather than simple subclasses of the built-in types. Which I suppose is
really no worse than the previous situation in terms of XML complexity,
but it's just more work so far as I can see. However, I'd still have to
do it on any complex types or containing elements, if I wanted the
attributes to be legal on non-leaf nodes as well.

Are there any easier ways?

-- Milton Taylor
Received on Tuesday, 3 July 2001 08:52:21 UTC

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