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

Re: XML Schemas and the Enumeration Facet

From: <petsa@us.ibm.com>
Date: Mon, 3 Jan 2000 17:08:10 -0500
To: Daniel Potter <dpotter@mitre.org>
cc: xml-dev@ic.ac.uk, www-xml-schema-comments@w3c.org
Message-ID: <8525685B.00799104.00@D51MTA03.pok.ibm.com>
Thanks for the comments.  See comments indicated by => below.

All the best, Ashok

Daniel Potter <dpotter@mitre.org>@w3.org on 01/03/2000 04:51:14 PM

Sent by:  www-xml-schema-comments-request@w3.org

To:   xml-dev@ic.ac.uk, www-xml-schema-comments@w3c.org
Subject:  XML Schemas and the Enumeration Facet

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 is an eror in the general category of "conflict between
=> facet values and should be called out as such.

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?)

=> This is a more difficult case.  Needs some thought!

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

=> I believe this is a typo.  Let me check with Paul, tho.

Thanks for any help on these questions.
Received on Monday, 3 January 2000 17:08:57 UTC

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