[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Extensible Enumerations Technique

From: Guillaume Lebleu <gl@brixlogic.com>
Date: Tue, 11 Mar 2008 10:11:08 -0700
Message-ID: <47D6BD2C.1070305@brixlogic.com>
To: xmlschema-dev@w3.org
Extensible Enumerations Technique

I know techniques for extensible enumerations in W3C XML Schema 1.0 have 
been discussed on this list before (extensively), but I didn't find the 
exact technique below, so I thought I'd post it here to get 
feedback/comment.

Enumeration types (say, Enumerated_Type) are defined as xs:union between 
a Enumerated_Type_Base and Enumerated_Type_Ext in a base XSD file:

<xs:simpleType name="Enumerated_Type">
   <xs:union memberTypes="Enumerated_Type_Base Enumerated_Type_Ext"/>
</xs:simpleType>

<xs:simpleType name="Enumerated_Type_Base">
   <xs:restriction base="xs:NMTOKEN">
      <xs:enumeration value="ExistingValue"/>
      ...
   </xs:restriction>
</xs:simpleType>

<xs:simpleType name="Enumerated_Type_Ext">
   <xs:restriction base="xs:NMTOKEN"/>
</xs:simpleType>

In the xs:redefine section of a separate extension XSD file redefines 
the Enumerated_Type_Ext:

<xs:simpleType name="Enumerated_Type_Ext">
   <xs:restriction base="Enumerated_Type_Ext">
      <xs:enumeration value="ExtendedValue"/>
   </xs:restriction>
</xs:simpleType>

XSLT stylesheets are then optionally used to remove xs:redefine and 
xs:union given that many tools (particularly XML/OO language binders) do 
not support these constructs.

Thanks in advance,

Guillaume
Received on Tuesday, 11 March 2008 17:11:26 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.