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

RE: Is enumeration valid for NMTOKENS?

From: Michael Kay <mike@saxonica.com>
Date: Sun, 30 Mar 2008 11:01:36 +0100
To: "'Siva Dirisala'" <siva@dirisala.net>, <xmlschema-dev@w3.org>
Message-ID: <020701c8924d$0c288ba0$e4f9a8c0@turtle>
RE: Is enumeration valid for NMTOKENS?
It is valid, but it's not particularly useful (and the spec isn't particular
clear about it). The list as a whole must match one of the enumerated
values. If you want to restrict the set of tokens that can appear in the
list, you should define a type T that derives from NMTOKEN, and then define
a list type with T as its itemType.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Siva Dirisala
Sent: 30 March 2008 10:04
To: xmlschema-dev@w3.org
Subject: Is enumeration valid for NMTOKENS?


I came across a schema definition where the attribute type is defined as

<xs:simpleType name="someType">
   <xs:restriction base="xs:NMTOKENS">
      <!-- bunch of xs:enumeration elements -->
   </xs:restriction>
</xs:simpleType>

I am not sure if the intent is that someType should be a list of values
where each value can be one of the enumerated values. Or it could be a
mistake and the base type should have been xs:NMTOKEN. I looked at the XML
Schema specification, but couldn't find any restriction in using a list type
as the base type for enumeration.

If the intent is to allow multiple values, then personally I would prefer
defining a type for the list elements and then another type that explicitly
uses the list and itemType to define a list of that restricted type. I would
like to know if the above definition is correct or it should be the way I
prefer.

thanks,
Siva
Received on Sunday, 30 March 2008 10:02:13 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.