W3C home > Mailing lists > Public > www-webdav-dasl@w3.org > January to March 2008

Re: casting literal values

From: Javier Godoy <rjgodoy@fich.unl.edu.ar>
Date: Fri, 15 Feb 2008 08:29:59 -0200
Message-ID: <007301c86fbd$b9a109e0$017ba8c0@Javier>
To: "Julian Reschke" <julian.reschke@gmx.de>, <www-webdav-dasl@w3.org>

Julian Reschke wrote:
> Javier Godoy wrote:
>> What happens if the property value can not be cast to the specified
>> datatype?:
>> - when casting a literal value (DAV:literal) if the property type is
>> known and the server chooses to treat the literal according to this type,
>> - when casting typed literal values.

Excuse me, I should have written "literal" instead of "property". So my
question is: what happens if the *literal* can not be cast to the specified

> if the DAV:typed-value specified in the query can not be converted to the
> desired type, it probably would be good to reject the query,

I agree. Should this behaviour be RECOMMENDED?

> as in
> <lt xmlns="DAV:"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <prop><edits xmlns="http://ns.example.org"/></prop>
>   <typed-literal xsi:type="xs:integer">foobar</typed-literal>
> </lt>
> Did you mean that case?

Yes, and about DAV:literal too, because Section 5.10 says [[
  when operand for a comparison with a property for which the type is known,
it MAY be treated according to this type

Suppose the type of the "edits" property is xs:integer.
If the server ignores its type, the following expression is valid, and it
evaluates to false because  "foobar" may not be a value of e:edits, if the
comparison is performed as if the property were xs:string (default

<eq xmlns="DAV:" xmlns:e="http://ns.example.org">

On the other hand, if the server knows e:edits is xs:integer, and it cast
the literal as xs:integer, the expression will not be not valid and there
will be a casting error (as in the typed-literal example above).

Note that
 <typed-literal xsi:type="xs:integer">foobar</typed-literal>
is likely a client's fault (e.g., it did not validate the literal against
the specified datatype)

In the DAV:literal case, whether the error is a fatal one or it is silently
ignored, depends on how the server handles DAV:literal for that property.
My point of view is that, since the client would have used DAV:typed-literal
if it wanted to force casting, the server MAY invalidate the query, or it
MAY fail as in the typed-literal case...

Does this make sense?

Best Regards,

Received on Friday, 15 February 2008 10:30:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:22:44 UTC