[
Lists Home |
Date Index |
Thread Index
]
At 3:26 PM +0200 5/7/02, Matthew Gertner wrote:
>Admittedly I am just restating the problem, but I am curious to know why you
>are so convinced that the data in XML documents are strings that can be
>translated into other data types when necessary,
Because an XML document is defined as a finite sequences of characters.
> and not dates, number, etc.
>that are serialized as strings when an XML document is instantiated.
In this case, you have some other data that is not an XML document.
This data is then translated into strings which are stored in an XML
document. However, not all XML documents are created this way. A
general purpose technology like XSLT/XPath that has to be defined for
all XML documents cannot rely on characteristics that apply to only
some XML documents; e.g. that they were created by converting numbers
into strings.
> The
>counterargument, which strikes me as extremely compelling, is that
>practically every environment *other* than an XML document would benefit
>from explicit use of the underlying datatypes. This includes storage
>engines, user interfaces (where formatting, localization and type/range
>checking must occur), most popular programming languages, etc.
The *counterexample* (which is to me far more compelling than a
counterargument) is that XSLT 1.0 works very well today without
worrying about data typing. So do SDAX, DOM, and pretty much all
existing XML technologies. The only possible exceptions I can think
of are SOAP and XML-RPC, and interestingly those are two that are
having big troubles with types because they insist on defining what a
string means as a type rather than just saying "Here's a string, do
what you want with it." (Actually, in practice, XML-RPC is often
implemented in that fashion rather than worrying too much about the
specified types.)
>I can
>certainly say from my experience programming in Java and C++ that I would
>prefer for a number to be a number and for a date to be a date, rather than
>having to constantly convert back and forth.
Too bad. With or without types in XSLT, you're going to have to
convert anyway, because the simple fact of the matter is that XML 1.0
documents don't contain numbers and never will. Perhaps an API will
one-day hide the conversion from you, but it's still going to have to
do it.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.cafeconleche.org/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
|