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

XML Schemas and the Enumeration Facet

  • From: Daniel Potter <dpotter@m...>
  • To: xml-dev@i..., www-xml-schema-comments@w...
  • Date: Mon, 03 Jan 2000 16:51:14 -0500

xml enumeration
I have some questions about using the enumeration facet along with other
facets which I hope someone can explain.

The enumeration facet is defined as "constrain[ing] the value space of
the datatype to the specified list" which I take to mean intuitively
that the "instances" of data which are to be checked against the
datatype with the enumeration must be in the list.

An enumeration could be as follows:

<datatype name="example" source="string">
   <enumeration value="first value">
   <enumeration value="another">
   <enumeration value="third">
</datatype>

This would mean that any elements corresponding to the example datatype
must be either "first value", "another" or "third".  So
<example>third</example> is OK, but <example>ABC</example> is wrong. 
(Assuming example is of type example, of course :)

HOWEVER, suppose that instead:

<datatype name="example" source="string">
   <enumeration value="first value">
   <enumeration value="another">
   <enumeration value="third">
   <maxlength value="7">
</datatype>

This would be OK, except that "first value" has a length of eleven,
meaning that it does not fit in the datatype where the maximum length is
seven.  However, it is specified to belong by enumeration.  Which takes
precendence?  The first to appear?  The last?

Can enumeration be used to add values which would otherwise be illegal? 
And what happens when enumeration is used with other facets?  Apparently
this is legal.  And if a user-defined datatype specifies facets over a
datatype with enumerated values, what happens if the new facets render
some of the enumerated values invalid?  (Or what if it enumerates values
which are illegal by the underlying datatype it's generated over?)

Finally, a quick question about the float/double datatype.  Should the
default exponent *really* be one?  Shouldn't it be zero?  According to
the spec, if Exx is not specified, it defaults to one.  Isn't 1E1 = 10? 
So wouldn't that multiply all values by ten compared to what the author
most likely intended?  (If I wrote <float>3.14159</float>, wouldn't it
be read as 31.4159?)  Just curious if this is a typo, or if I'm
misunderstanding something, or if it is intended the way I understand
it.

Thanks for any help on these questions.


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



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.