RE: [DM] Typed value of document node

We could achieve this, without loss of backwards compatibility in the
untyped case, by specifying that the typed value of a document node is
the concatenation of the typed values of its children, each such typed
value being first converted to a string, with the final result being
xdt:untypedAtomic.

What did you think of my other suggestion, of saying that the typed
value of an element with child elements should be a string, thus
allowing its use in a string context (like contains()) but not in a
numeric context?

Michael Kay



> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Jonathan Robie
> Sent: 15 February 2004 23:49
> To: XML Query Comments
> Subject: [DM] Typed value of document node
> 
> 
> 
> If an element has a complex type with complex content, the
> typed-value() accessor raises a type error when applied to 
> the element. So if the Cities element has a known type, the 
> following raises a type error:
> 
>   <Cities>
>     <City>
>         <CityId>01</CityId>
>         <Longitude>100</Longitude>
>         <Latitude>32</Latitude>
>     </City>
>     <City>
>         <CityId>02</CityId>
>         <Longitude>54</Longitude>
>         <Latitude>24</Latitude>
>     </City>
>   </Cities> * 2
> 
> If you the same element is placed in a document node, the
> typed-value() accessor returns its string value, as an 
> instance of xdt:untypedAny. Consider the following query.
> 
> document {
>   <Cities>
>     <City>
>         <CityId>01</CityId>
>         <Longitude>100</Longitude>
>         <Latitude>32</Latitude>
>     </City>
>     <City>
>         <CityId>02</CityId>
>         <Longitude>54</Longitude>
>         <Latitude>24</Latitude>
>     </City>
>   </Cities>
> } * 2
> 
> This query succeeds. Either both queries should succeed,
> or both should fail.
> 
> Jonathan
> 

Received on Monday, 16 February 2004 05:00:47 UTC