Redefining an enumerated attribute type

  • Thread starter Nick Bassiliades
  • Start date
N

Nick Bassiliades

Hi everybody,

I would like to ask a very specific question about how I can re-define
an enumerated attribute type.
Specifically, I have two XML Schema files.

In file A I have the following attribute group declaration:

*********** file A ******************
<xs:attributeGroup name="kind.attrib">
<xs:attribute name="kind" use="optional" default="fo">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="fo"/>
<xs:enumeration value="lp"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
*************************************

I file B I want to re-define this attribute in order to include
more constants as possible values for the @kind attribute.
The following produces an error, because the new definition
is not a restriction of the definition found in file A:

***************** file B *********************
<xs:redefine schemaLocation="...file A">
<xs:attributeGroup name="kind.attrib">
<xs:attribute name="kind" use="required" default="dr">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="fo"/>
<xs:enumeration value="lp"/>
<xs:enumeration value="sr"/>
<xs:enumeration value="dr"/>
<xs:enumeration value="df"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
....
*************************************


Notice, that I cannot just change the definition in file A because I
simply do not own it.
How could this be done? How could I extend in a redefinition and not
restrict it?

I have also tried with union but I get the same message (union is an
extension, not a restriction).

Thank you in advance,

Nick Bassiliades
 
H

Henry S. Thompson

Nick Bassiliades writes:

I file B I want to re-define this attribute in order to include
more constants as possible values for [an enumeration].
Notice, that I cannot just change the definition in file A because I
simply do not own it.
How could this be done? How could I extend in a redefinition and not
restrict it?

The short answer is 'no'.

The slightly longer answer is that there are good ways to design an
extendable enumeration type, but that requires a change to the
original definition, which you say you can't do.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top