W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2006

Extensible enumerations in XML Schema

From: <andreas.ebbert-karroum@nokia.com>
Date: Thu, 23 Nov 2006 15:18:51 +0100
Message-ID: <64B12EB48D590F4CB3D2A64BD371049A040651BF@duebe101.NOE.Nokia.com>
To: <xmlschema-dev@w3.org>

Hi,

my problem is the following. I have a complex type that has one attribute that is based on an enumeration. The XML schema that I define is fixed, but a customer/user of that schema should be able to add items to the enumeration in an additional schema. 

Currently the approach is:
1) use an element reference in the complex type
2) have an abstract element of type string
3) define a simple type that contains the enum literals based on string
4) have another element, that is of simple type and has the abstract element as substitution group.
5) Users can extend the enumeration, by repeating step 3&4 in an own schema, and provide a different enumeration simpleType, which ideally includes the enum values of the original/parent simpleType.

Details to the steps are further down.
My questions are:
=> Is there a better way to do this? For example that a client/user don't have to repeat all existing enums, but can somehow merge them in with a union simple type?
=> How could a complex type definition look like that is an array of the enum, and is also capable of using the customer extension?

1) 
	<complexType name="BusinessInteractionValue">
		<complexContent>
			<extension base="ns3:EntityValue">
				<sequence>
					<element ref="ns0:baseState" minOccurs="0"/>
				</sequence>
			</extension>
		</complexContent>
	</complexType>

2)
	<element name="baseState" type="string" abstract="true"/>

3)
	<element name="state" type="ns0:RequestState" substitutionGroup="ns0:baseState"/>

4)
	<simpleType name="RequestState">
		<restriction base="string">
			<enumeration value="ABORTED"/>
			...
			<enumeration value="PARTIALLY_COMPLETED"/>
		</restriction>
	</simpleType>

5) -- in a separate schema --
	<simpleType name="ExtendedRequestState">
		<restriction base="string">
			<enumeration value="ABORTED"/>
			...
			<enumeration value="PARTIALLY_COMPLETED"/>
			<enumeration value="open.running.new1"/>
			<enumeration value="open.running.new2"/>
			<enumeration value="open.running.new3"/>
		</restriction>
	</simpleType>
	<element name="extendedRequestState" type="aek:ExtendedRequestState" substitutionGroup="om:baseState"/>

 _         __                _  _
//\ndreas.[|-bbert-[]/arroum(a)[|\|okia.com
           `-        `
   Andreas Ebbert-Karroum
         Senior Software Design Engineer
                Nokia Networks Services / Middleware 
   phone: +49-211-94123928, fax: +49-211-9412-3838
   Heltorfer Straße 1, 40472 Düsseldorf, Germany 

----------------------------------------------------------------------
This message is confidential. If you have received this message in error,
please delete it from your system. You should not copy it for any purpose,
or disclose its contents to any other person. Internet communications are
not secure and therefore Nokia GmbH does not accept legal responsibility
for the contents of this message as it has been transmitted over a public
network. Thank you.
Nokia GmbH, Nokia Networks is a German Company. Further information
about the Company is available from its principal offices at
Heltorferstrasse 1, D-40472, Düsseldorf, Germany and from the
website at http://www.nokia.com/
----------------------------------------------------------------------
Received on Tuesday, 28 November 2006 07:24:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC