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

RE: different attribute value sets for the same element ref?

From: Giles Hogben <giles.hogben@jrc.it>
Date: Tue, 15 Apr 2003 11:29:09 +0200
To: "Jeni Tennison" <jeni@jenitennison.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <GAEKIJGJBJOBBJEFAHMLCEMPCIAA.giles.hogben@jrc.it>

Thanks Jeni - that explains the syntax now. It's not so much that I want to
reuse information - it's more just to reflect the true semantics that the
categories elements are really all the same semantic with their allowed name
values from a shared set rather than locally defined and semantically
different things. I guess XSD writers shouldn't worry about semantics as it
was never meant for this but...
I think I will go for the derived type solution - that sounds like the
closest...

-----Original Message-----
From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org]On Behalf Of Jeni Tennison
Sent: Tuesday, April 15, 2003 11:19 AM
To: Giles Hogben
Cc: xmlschema-dev@w3.org
Subject: Re: different attribute value sets for the same element ref?



Hi Giles,

> The point is that I need to use the category element many times in
> my schema (say 50), each time with a different allowable set of
> values for name. The solution you give below does not allow reuse of
> the category element + name attribute definition (does it?).

In XML Schema, each declaration specifies the name and the type
(content/value) of the element or attribute. You cannot say "I want
to reuse this declaration but with this different type". Each time you
want to have an element or attribute with a different name or type you
have to have a different declaration for it. Those declarations can be
local (declared within the complex type of a particular element) in
order to prevent name clashes.

I'm not sure what information about the category element or name
attribute you want to reuse, but it might be that you can get reuse by
deriving the type of each of your fifty category elements from the
same type.

Or it might be that you could assign a union type to the name
attribute to represent the choices between sets of enumerated values,
but the schema would not then check whether a particular category
element had one of a particular set of values for its name attribute.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 15 April 2003 05:26:46 GMT

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