[
Lists Home |
Date Index |
Thread Index
]
At 11:35 PM 12/4/2002 +0000, Sean McGrath wrote:
>Besides, the more you tightly bind data types to chunks of your XML the more
>tightly you are binding XML to a process.
How does providing a datatype do that, if you still have access to the
lexical representation?
>The whole point of XML is that is separates
>content from process so that your content can outlive your processes.
Hi Sean,
We both want to separate content from process, letting the content have its
own meaning independently of the way it is processed. My gut says that
providing type information helps meet this goal. Your gut seems to say the
opposite.
You are saying that providing more information about data somehow binds XML
to a process. I think that providing more data allows general purpose tools
to process the data correctly without deep knowledge of the semantics of a
given schema. For instance, consider the following:
input()//value * 4
If the value is an integer, I would like to use integer arithmetic, which
is precise and fast. If the value is an arbitrary precision decimal number,
I have to use slower - but accurate - arbitrary precision arithmetic. If
the value is a floating point number, then I have to use slower and
approximate floating point arithmetic. If it is untyped data, then XQuery
attempts to cast it to a double, which is what XPath 1.0 does for all data
used in arithmetic operations.
So the presence of datatype information allows generic tools like XQuery to
"do the right thing", without requiring you to "run the right program". It
helps separate content from specific programs. I don't have to know that
this particular value is supposed to be an arbitrary precision decimal and
write code to handle it correctly.
Jonathan
|