RE: Easier way to define enumerations

I was aware of the whitespace problem as explained below,
but was not careful enough to think it through. Still,
I think it's easy to provide shortness while avoiding
the problem, e.g. by defining that xsd:enumeration
can have either a 'value' attribute (containing a single
value) or a 'valuelist' attribute (containing a list
of values, whitespace-separated). This would allow
to address values with and without whitespace.

Regards,   Martin.

At 00/05/25 15:32 -0700, Biron,Paul V wrote:
> > -----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 Friday, 26 May 2000 02:23:13 UTC