Bug #651
closedError when cast used in XQuery attribute constructor
0%
Description
SourceForge user: mhkay
The spurious error message
Cannot cast to xdt:anyAtomicType
occurs when a "cast as" expression is used within an
enclosed expression in a direct attribute constructor,
for example
(the reason for this is that such enclosed expressions
must be initially processed without knowledge of the
in-scope namespaces, since namespace declarations can
follow attributes. So there is a "scan only" mode of
parsing, and in this mode any reference to an atomic
type name is treated temporarily as a reference to
xdt:anyAtomicType. But a cast to xdt:anyAtomicType is
not permitted, and Saxon 8.5 is checking for this error
during the "scan only" phase of processing).
Source fix: at line664 of
net.sf.saxon.expr.ExpressionParser.java, change
if (scanOnly) {
return Type.ANY_ATOMIC_TYPE;
}
to
if (scanOnly) {
return Type.STRING_TYPE;
}
Please register to edit this issue