473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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
Dec 9 '05 #1
1 1256
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]
Dec 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alastair Cameron | last post by:
I have a VB (VB6, not .NET) application that reads an XML file (using MSXML v3.2 parser); the XML file contains a reference to an external DTD. The DTD has numerous enumerated attribute...
22
by: Ben Finney | last post by:
Howdy all, I've recently packaged 'enum' in PyPI. In its description, I make the claim that it creates "immutable" enumeration objects, and that the enumeration values are "constant" values. ...
1
by: davidmcb | last post by:
I have defined an enumerated type that I use in various places in my schema. I am in the process of creating a new complex type that contains an attribute that I want to restrict to NOT being a...
0
by: Pepe | last post by:
Hi, I'm very new in XML and am seeking advice for the following: My element DATA has a UNIT attribute that is an enumerated list. This tag stores medical measurements, such as volume of aire,...
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
7
by: John Goche | last post by:
Hello, The following program compiler and runs fine under gcc and produces the output 3. However, I am not sure whether such behavior is legal. In particular, as a related question, how would I...
1
by: senfo | last post by:
I'm using an enumerated type to identify a record type that relates to a unique ID in a database. Identity columns in SQL start at 1, while enumerated types in C# start at 0. I didn't think it...
4
by: Olivier Lefevre | last post by:
I want to define an attribute as a list of values taken from a finite set, with a singleton default. Intuitively I want to write attrname (AA|BB|CC)* "AA" but that is not valid syntax and I...
4
by: Rex the Strange | last post by:
Hello all, Can anyone please tell me why I can't do this (and what I can do to get the equivalent effect): In the code: public enum myenum value1 value2
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.