This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5261 - [FO] errors in cast vs. construction
Summary: [FO] errors in cast vs. construction
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2007-11-09 08:46 UTC by Tim Mills
Modified: 2008-03-11 13:29 UTC (History)
0 users

See Also:


Description Tim Mills 2007-11-09 08:46:16 UTC
XQTS contains two similar tests, K2-SeqExprCast-248


which expects error FORG0001 (Invalid value for cast/constructor)

and CastAs180

xs:float("INF") cast as xs:integer

which expects error FOCA0002 (Invalid lexical value).

Since construction and casting both normalize to the same form, these should surely expect the same error.  Personally, I'd favour FORG0001.

Relevant areas of the specification are: Casting to xs:decimal Casting to xs:integer

"If SV is one of the special xs:float or xs:double values NaN, INF, or -INF, an error is raised [err:FOCA0002]."


"If casting from the input type to the target type is supported but nevertheless it is not possible to cast the input value into the value space of the target type, a dynamic error is raised. [err:FORG0001] This includes the case when any facet of the target type is not satisfied. For example, the expression "2003-02-31" cast as xs:date would raise a dynamic error."

Note that the latter does not even mention the possibility of FOCA0002.
Comment 1 Michael Kay 2008-01-15 00:34:19 UTC
The casting section of the XQuery book states "A summary of the rules are listed below  the normative definition of these rules is given in [XQuery 1.0 and XPath 2.0 Functions and Operators]." So it's clear that the F+O definition is intended to take precedence. Whether we want to modify the text to align it at the level of defining error codes, I don't know.
Comment 2 Tim Mills 2008-01-15 10:20:28 UTC
I've changed our implementation to throw FOCA0002 in this case.  The expected error is now correct in CVS, however our implementation disagress with the expected error code (FORG0001) for K2-SeqExprCast-254 to K2-SeqExprCast-331.

These cases are of the form:


where some-type-derived-from-integer includes xs:byte, xs:nonPositiveInteger, negativeInteger etc.

I'll report these as errors against XQTS.
Comment 3 Michael Kay 2008-03-11 13:24:32 UTC
At the joint WG meeting on 2008-03-04, it was decided to change the language book to delete references to specific F&O error codes in the casting section, to remove conflicts and the potential for conflict. The language book already says that the F&O specification of casting is the normative one.

I am changing the resolution to FIXED. Tim Mills, as the originator, if you agree with this resolution please change the status to CLOSED.
Comment 4 Tim Mills 2008-03-11 13:29:21 UTC
Thanks.  Hopefully this can now be reflected in XQTS (Bug 5363).