XML Schemas and the Enumeration Facet

Daniel Potter dpotter at mitre.org
Mon Jan 3 21:58:55 GMT 2000

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.

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

More information about the Xml-dev mailing list