RE: Easier way to define enumerations

> -----Original Message-----
> From:	petsa@US.IBM.com [SMTP:petsa@US.IBM.com]
> Sent:	Wednesday, May 24, 2000 9:29 AM
> To:	Martin J. Duerst
> Cc:	www-xml-schema-comments@w3.org
> Subject:	Re: Easier way to define enumerations
> 
> Yes, now that we have lists this seems reasonable.  We'll put it to the
> WG.
> 
> "Martin J. Duerst" <duerst@w3.org>@w3.org on 05/21/2000 05:10:53 AM
> To:   www-xml-schema-comments@w3.org
> Subject:  Easier way to define enumerations
> 
> This is a last call comment to XML Schema Structures.
> 
> It should be possible to write
> 
> <xsd:enumeration value='AK AL AR...' />
> 
> instead of
> 
> <xsd:enumeration value='AK' />
> <xsd:enumeration value='AL' />
> <xsd:enumeration value='AR' />
> ...
> 
> to get a more reasonable and compat notation, in particular
> for cases where the number of enumerated items is large.
> 
While I'm sympathetic to this suggestion, I do not think it works in the
general case.  The reason is that the lexical space of a list datatype is a
whitespace separated sequence of tokens (which, by definition, cannot
contain whitespace).  Therefore, with the proposed syntax, there would be no
way to create a subtype of a list type by enumeration.  For example,

<xsd:simpleType name='list-of-string' base='xsd:string' derivedBy='list'/>
<xsd:simpleType name='enum-of-list-of-string' base='list-of-string'>
   <xsd:enumeration value='this is a test'/>
   <xsd:enumeration value='of the emergency'/>
   <xsd:enumeration value='broadcast system'/>
</xsd:simpleType>

The *intension* of enum-of-list-of-string is to create a datatype whose
value space is the set of 3 strings "this is a test", "of the emergency" and
"broadcast system"; however, what we have defined is the set of 9 strings
"this", "is", "a", "test", "of", "the", "emergency", "broadcast", "system".

pvb

Received on Thursday, 25 May 2000 19:08:25 UTC