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