← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: [xml-dev] Adam Bosworth Article - what does "directaccess"m ean?

From
Jonathan Robie <>
To
Joe English <>, XML DEV <>
Date
2003-01-20T14:54:50Z
ID
<>
Thread
Re: [xml-dev] Adam Bosworth Article - what does "directaccess"m ean?
At 10:38 AM 1/19/2003 -0800, Joe English wrote:

>W. E. Perry wrote:
> >
> > I'm sorry, Jonathan, I don't understand. What is
> >
> >     return $stock/price / ($stock/revenues - $stock/expenses)
> >
> > except the execution of subtraction and division arithmetic
> > operations agains t the 'values' of $stock/price,
> > $stock/revenues, and $stock/expenses? And if your query
> > is against XML, then the values of those i tems are
> > runs of Unicode text, and your arithmetic operations
> > are effectively meaningless.
>
>Not necessarily: the infix operator "-" can easily be
>defined as an operation on strings.   Parse the left and
>right operands as numbers (raising an error if they're not
>syntactically valid), subtract one from the other, then
>format the result as a string.

If an operand of an arithmetic operator is not typed, XQuery attempts to 
cast it to a double. This cast may fail. This is exactly what XPath does, 
and it is also - as Joe points out - analogous to what TCL does.

Of course, if datatypes are present, they are observed, unless the writer 
of the query explicitly casts data to something untyped.

Jonathan
← Prev in month ← Prev in thread
Next in thread → Next in month →