return new BigDecimal((BigInteger) a);
if(a instanceof LazyLiteral){
a = ((LazyLiteral)a).getLiteral();
}
if (a instanceof TypedLiteral) {
final TypedLiteral tl = (TypedLiteral) a;
String content = tl.getContent().substring(1,
tl.getContent().length() - 1);
while(content.startsWith("+")){
content = content.substring(1,content.length());
}
if (isInteger(tl.getType()))
return new BigDecimal(new BigInteger(content));
if (tl.getType().compareTo(
"<http://www.w3.org/2001/XMLSchema#float>") == 0)
return new BigDecimal(Float.parseFloat(content));
if (tl.getType().compareTo(
"<http://www.w3.org/2001/XMLSchema#double>") == 0)
return new BigDecimal(Double.parseDouble(content));
if (tl.getType().compareTo(
"<http://www.w3.org/2001/XMLSchema#decimal>") == 0)
return new BigDecimal(content);
}
throw new TypeErrorException();
}