W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

XML Schemas and the Enumeration Facet

From: Daniel Potter <dpotter@mitre.org>
Date: Mon, 03 Jan 2000 16:51:14 -0500
Message-ID: <387119D2.85F33FBE@mitre.org>
To: xml-dev@ic.ac.uk, www-xml-schema-comments@w3c.org
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">

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">

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

Thanks for any help on these questions.
Received on Monday, 3 January 2000 16:58:55 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:46 UTC