Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Redefining an enumerated attribute type (http://www.velocityreviews.com/forums/t170299-redefining-an-enumerated-attribute-type.html)

Nick Bassiliades 12-09-2005 01:43 PM

Redefining an enumerated attribute type
 
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

Henry S. Thompson 12-12-2005 01:21 PM

Re: Redefining an enumerated attribute type
 
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: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]


All times are GMT. The time now is 09:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.