Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Extensible enumerations in XML Schema

Thread Tools

Extensible enumerations in XML Schema

Posts: n/a

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?

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

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

<element name="state" type="ns0:RequestState"

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

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"/>
<element name="extendedRequestState" type="aek:ExtendedRequestState"

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear Java 3 02-20-2007 09:56 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
XML Schema - How to do a key-value map with 2 enumerations? Joyce XML 1 02-18-2005 07:43 PM
XML Schema to XML Schema Conversion Hari Om XML 1 03-02-2004 09:04 PM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM