RE: typed-value accessor

Correct, text nodes have no type annotation.

The only time you ever need to use text nodes is when handling mixed
content, in which case you can't assign a type to the text nodes in your
schema. There is no need ever to retrieve the text node of an element with
simple content, so I don't see it as a problem that it is untyped.

Michael Kay


> -----Original Message-----
> From: Andrey Fomichev [mailto:fomichev_andrei@mail.ru] 
> Sent: 09 June 2003 14:46
> To: www-ql@w3.org
> Subject: typed-value accessor
> 
> 
> 
> Hello!
> 
> I've been working on XQuery implementation for more than a 
> year and I've been seeing some weaknesses in XQuery 
> specification. But now when the Last call of Data Model is 
> released, I'm worried about some things very much. Sorry, if I wrong.
> 
> Suppose we have variable $x bound to XML element <a>5</a> 
> with integer type annotated. And we have the following two 
> expressions: 1. $x + $x 2. $x/text() + $x/text()
> 
> According to data model and XQuery specification the first 
> expression evaluates to atomic value, which has value 10 and 
> type integer. The second expression evaluates to atomic 
> value, which has value 10.0 and type double. The results are 
> different.
> 
> The key to the problem is the following phrase from 
> definition of typed-value accessor from Data Model.
> 
> If the node is a comment, document, namespace, 
> processing-instruction, or text node, then its typed value is 
> equal to its string value as an instance of xdt:untypedAtomic.
> 
> So, does it true, that text nodes have no type annotation? If 
> it is true, it can lead to some strange behavior of query 
> processors, as it is shown.
> 
> Hope, that I wrong,
> Andrey Fomichev
> 

Received on Monday, 9 June 2003 10:41:41 UTC