[
Lists Home |
Date Index |
Thread Index
]
david.lyon@computergrid.net wrote:
> In XML 1.0, we have a larger file with no type information
> and in the computergrid format, we have type information as
> well as a saving of around 35% or 2,680,000 bytes.
>
It's smaller, though somehow I doubt that's important, but I'll leave
that point be. However, it is simply not true that the custom format
you've invented has even one bit more of type information than the XML
format.
There is no rule anywhere that says that $ means an int or ? means a
boolean or @ means a date. This is simply one interpretation of the
plain text content, which you have written into your code. You could
just as easily (probably more so) written knowledge into your code that
sell_price and cost_price are ints, InStock is a boolean, and
Arrival_Date is a date.
The XML document in both cases contains pretty much the same
information, none of which has anything to do with data types. In both
cases, the types are inferred by the code processing the XML document. A
different process might usefully infer different types, for instance
using a double type or a money type for the sell_price and cost_price.
(In fact, maybe that's what you meant. I don't remember.) The types are
in your code, not i the XML.
The real difference is that the more verbose format is much easier to
process with XML aware tools like XPath, XQuery, XSLT, SAX, and XOM.
Your custom format requires you to develop and maintain your own custom
parser because you haven't used XML to markup the relevant structure.
--
Elliotte Rusty Harold elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
|