Re: casting literal values

Javier Godoy wrote:
> A short comment about casting literal values:
> 
> (Section 5.11)  [[
> The comparison evaluates to UNDEFINED if the property value can not be 
> cast to the specified datatype.
> ]]
> 
> 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.
> 
> Failing with 422 seems logical, though it is not explicitly stated. 
> IMHO, it may help to recommend servers not to be lenient about this.
> ...

If the *instance* of the property can not be converted to the requested 
type, that expression evaluates to UNKNOWN, as said in 5.11. As such, it 
  doesn't make the query itself invalid, and thus no error needs to be 
returned.

However, 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, 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?

BR, Julian

Received on Thursday, 14 February 2008 21:14:37 UTC