W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

[DM] Typed value of document node

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Sun, 15 Feb 2004 18:49:24 -0500
Message-ID: <40300584.6010805@datadirect.com>
To: XML Query Comments <public-qt-comments@w3.org>

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 Sunday, 15 February 2004 18:51:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC