// type.compareTo("<http://www.w3.org/2001/XMLSchema#integer>")
// == 0
if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#nonPositiveInteger>") == 0
&& bi.compareTo(new BigInteger("0")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#negativeInteger>") == 0
&& bi.compareTo(new BigInteger("0")) >= 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#long>") == 0
&& bi.compareTo(new BigInteger("-9223372036854775808")) < 0
&& bi.compareTo(new BigInteger("9223372036854775807")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#int>") == 0
&& bi.compareTo(new BigInteger("-2147483648")) < 0
&& bi.compareTo(new BigInteger("2147483647")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#short>") == 0
&& bi.compareTo(new BigInteger("-32768")) < 0
&& bi.compareTo(new BigInteger("32767")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#byte>") == 0
&& bi.compareTo(new BigInteger("-128")) < 0
&& bi.compareTo(new BigInteger("127")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#nonNegativeInteger>") == 0
&& bi.compareTo(new BigInteger("0")) < 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#unsignedLong>") == 0
&& bi.compareTo(new BigInteger("0")) < 0
&& bi.compareTo(new BigInteger("18446744073709551615")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#unsignedInt>") == 0
&& bi.compareTo(new BigInteger("0")) < 0
&& bi.compareTo(new BigInteger("4294967295")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#unsignedShort>") == 0
&& bi.compareTo(new BigInteger("0")) < 0
&& bi.compareTo(new BigInteger("65535")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#unsignedByte>") == 0
&& bi.compareTo(new BigInteger("0")) < 0
&& bi.compareTo(new BigInteger("255")) > 0)
throw new TypeErrorException();
else if (type
.compareTo("<http://www.w3.org/2001/XMLSchema#positiveInteger>") == 0
&& bi.compareTo(new BigInteger("0")) <= 0)
throw new TypeErrorException();
} catch (final NumberFormatException nfe) {
throw new TypeErrorException();
}
} else if (type.compareTo("<http://www.w3.org/2001/XMLSchema#float>") == 0) {
try {
Float.parseFloat(realContentWithoutDoubleQuote);
} catch (final NumberFormatException nfe) {
throw new TypeErrorException();
}
} else if (type.compareTo("<http://www.w3.org/2001/XMLSchema#double>") == 0) {
try {
Double.parseDouble(realContentWithoutDoubleQuote);
} catch (final NumberFormatException nfe) {
throw new TypeErrorException();
}
} else if (type.compareTo("<http://www.w3.org/2001/XMLSchema#decimal>") == 0) {
try {
new BigDecimal(realContentWithoutDoubleQuote);
// any exponent is not allowed for the representation of
// decimals! (The rest has been checked in the previous line!)
if (realContentWithoutDoubleQuote.contains("e")
|| realContentWithoutDoubleQuote.contains("E")) {
throw new TypeErrorException();
}
} catch (final NumberFormatException nfe) {
throw new TypeErrorException();
}
} else if (isDate(type)) {
try {
getDate(realContentWithoutDoubleQuote);
} catch (final Exception e) {
throw new TypeErrorException();
}
} else if (type.compareTo("<http://www.w3.org/2001/XMLSchema#boolean>") == 0) {
if (!(realContentWithoutDoubleQuote.compareTo("true") == 0
|| realContentWithoutDoubleQuote.compareTo("false") == 0
|| realContentWithoutDoubleQuote.compareTo("0") == 0 || realContentWithoutDoubleQuote
.compareTo("1") == 0))
throw new TypeErrorException();
}
// created casted TypedLiteral!
try {
return LiteralFactory.createTypedLiteral(realContent, type);
} catch (final URISyntaxException e) {
throw new TypeErrorException();
}
}