castType.equals(XSDDatatype.XSDdouble) ||
castType.equals(XSDDatatype.XSDboolean) ||
castType instanceof XSDAbstractDateTimeType ) // Includes durations, and Gregorian
{
if ( s.startsWith(" ") || s.endsWith(" ") )
throw new ExprEvalException("CastXSD: Not a valid literal form (has whitespace): '"+s+"'") ;
}
}
// Plain cast.
try {
if ( ! castType.isValid(s) )
throw new ExprEvalException("CastXSD: Not a valid literal form: '"+s+"'") ;
// Unfortunately, validity testing happens in NodeValue.makeNode as well.
// but better error messages this way.
return NodeValue.makeNode(s, castType) ;
} catch (RuntimeException ex) {
throw new ExprEvalException("CastXSD: Not a strictly valid literal form: '"+s+"'") ;
}
}