Extensible enumerations in XML Schema

Discussion in 'XML' started by SkyScrap, Nov 23, 2006.

  1. SkyScrap

    SkyScrap Guest

    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"/>
     
    SkyScrap, Nov 23, 2006
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,784
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    1,062
    Martin Honnen
    Feb 5, 2004
  3. Joyce
    Replies:
    1
    Views:
    2,505
    Stan Kitsis [MSFT]
    Feb 18, 2005
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,428
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    3,747
Loading...

Share This Page