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

RE: alternate enums in XML Schema

  • From: "Arnold, Curt" <Curt.Arnold@h...>
  • To: "'xml-dev@x...'" <xml-dev@x...>
  • Date: Fri, 5 May 2000 09:42:53 -0600

enums in xml
Having a distinct lexical and value for enumerations (ala enums in C++,  Java) etc was suggested repeatedly and not take up in the W3C XML Schema process.  Your syntax fragment looks like Microsoft
XML-Data Reduced and not like W3C schema  The idea was that you could do something like:

<simpleType name="paymentMethod" base="integer">
	<!-- open would allow for values not explicitly listed   -->
	<enumeration open="true">
		<value lexical="BNK" value="1"/>
		<value lexical="BNT" value="2"/>
		<value lexical="CBF" value="3"/>
		<value lexical="CHF" value="4"/>
		<value lexical="COM" value="5"/>
	</enumeration>
</simpleType>

In the current working draft, you can:

<simpleType name="paymentMethod" base="string">
	<enumeration value="BNK"/>
	<enumeration value="BNT"/>
	<enumeration value="CBF"/>
	<enumeration value="CHF"/>
	<enumeration value="COM"/>
</simpleType>

Which means that payment method is required to be one of the five declared types.

If you want to add some information to the schema that an application can access, but is not used in validation, you can use an appinfo element.

<simpleType name="paymentMethod" base="string">
	<enumeration value="BNK">
		<annotation>
			<appinfo>
				<myapp:enumeration value="1"/>
			</appinfo>
		</annotation>
	</enumeration>
</simpleType>
...
</simpleType>

If you wanted to allow new values to be added dynamically, but wanted to provide some symbolic information for applications in the same resource, you could do

<simpleType name="paymentMethod" base="integer">
	<annotation>
		<appinfo>
			<myapp:symbol value="1" symbol="BNK"/>
			...
		</appinfo>
	</annotation>
</simpleType>

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.