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

[DM] Typed value for elements

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Wed, 11 Feb 2004 21:02:35 -0500
Message-ID: <402ADEBB.8080205@datadirect.com>
To: XML Query Comments <public-qt-comments@w3.org>

The rules for dm:typed-value() are confusing and inconsistent for
elements and document nodes. Here is an example that illustrates one
set of problems: what is the result of the following query?

  <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

In the current specification, this question can not be answered unless
we know the schema information associated with the Cities
element. Here is the current set of rules:

1. If the element has a known complex type, and it does not allow
mixed content, then it raises a type error.

2. If this element's type is xdt:untypedAny, the typed value of the
element is its string value, as an instance of xdt:untypedAtomic, so
this query evaluates to (2 * 0110032025424). This is surprising, and
it is not useful for users.

3. If this element's type is known, and it allows mixed content, the
typed value of the element is its string value, as an instance of
xdt:untypedAtomic, so this query evaluates to (2 * 0110032025424).

It would be much simpler and cleaner to say that dm:typed-value()
returns an error for any node with child elements. This is
incompatible with the behavior of XPath 1.0, but so is the current
behavior for elements of known complex type.

Jonathan
Received on Wednesday, 11 February 2004 21:05:24 UTC

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