Why XML data typing is hard

david at megginson.com david at megginson.com
Mon Nov 30 14:45:21 GMT 1998

Michael Kay writes:

 > "4,50" is a localized rendition of a float value. But in XML we
 > should encourage a rendition-independent encoding of information.

That is one of the biggest problems with applying concepts from data
storage to syntax.  XML *is* pure external representation -- in a
database, I can take any of the following appropriate to my locale and
store it internally as the same bunch of bits:


When I want to render that bunch of bits, I can pick any appropriate
rendition based on the user's locale and formatting requests (for
example, the user might have typed "4.50" into a field in a form, but
the report for a French user might show "04,5").

With XML, though, it is the representation itself that I'm exchanging,
not the abstract data (though perhaps in the future people might want
to pass around compiled DOM trees -- who knows?).  That means that if
I put


and send the document to a French user, the French user will still see 
the strange, foreign


There's not a general-purpose, locale-independent way of storing it.
You could define a local-independent text representation of a
floating-point number, but then you're just adding yet another
representation to the list.

Please note that I'm *not* opposed to data typing: I think that it's
necessary and that we will see something like it sooner or later.  I
know that the XML Schema WG plans to work hard on data typing and that
since there are many good, talented people in that WG, they are very
likely to surprise us; in the mean time, however, I just want to
emphasise that [1] the problem is not easy when you move beyond a
specific locale and/or application domain (regular expressions won't
cut it for usability), and that [2] the solution will likely provide
less functionality than many people expect.

All the best,


David Megginson                 david at megginson.com

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/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe 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