OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: alternate enums in XML Schema

[ Lists Home | Date Index | Thread Index ]
  • From: "Arnold, Curt" <Curt.Arnold@hyprotech.com>
  • To: "'xml-dev@xml.org'" <xml-dev@xml.org>
  • Date: Fri, 5 May 2000 09:42:53 -0600

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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS