W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Re: Clarification on enumerations

From: <noah_mendelsohn@us.ibm.com>
Date: Mon, 22 Jul 2002 20:18:06 -0400
To: Eric van der Vlist <vdv@dyomedea.com>
Cc: Jeni Tennison <jeni@jenitennison.com>, Michael Leditschke <mike@ammd.com.au>, "Biron,Paul V" <Paul.V.Biron@kp.org>, xmlschema-dev@w3.org
Message-ID: <OF7FD4B739.F0897B48-ON85256BFF.0000C38A@lotus.com>

I am one of those who agree (and agreed) with Paul that having constraints 
at two levels is messy in the type system.  It's not too bad when doing 
validation of character strings.  It's very difficult if you try to build 
an API that lets programs synthesize documents using values.  Consider an 
integer that's constrained by a regex facet to have exactly two digits, 
the first of which can be a leading zero.  Now, let's assume we've 
invented the obvious Java API for building up the value of this integer:


where the signature of set is:

        void set(int)

OK, how do you validate?  Well, one way to do it is to convert the integer 
to canonical form ("3") and decide that it's invalid.  Another is to 
embark on a theorem proving exercise to discover that the representation 
"03" would be perfectly legal.   Of course, if you're always manipulating 
characters, there's no issue, but why have a value space at all then? 
Presumably, it's so that applications can work at the value level when 
desired.  Constraining at two levels is a mess IMO (not without value, 
just a mess.)

Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
Received on Monday, 22 July 2002 20:19:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC