//some of the abstract code in EXQuery needs to be able to instantiate types.
//Consider a factory or java.util.ServiceLoader pattern
if(typedValue instanceof org.exquery.xdm.type.StringTypedValue) {
value = new StringValue(((org.exquery.xdm.type.StringTypedValue)typedValue).getValue());
} else if(typedValue instanceof org.exquery.xdm.type.Base64BinaryTypedValue) {
value = BinaryValueFromInputStream.getInstance(xqueryContext, new Base64BinaryValueType(), ((org.exquery.xdm.type.Base64BinaryTypedValue)typedValue).getValue());
} else {
value = (Item)typedValue.getValue();
}
if(existDestinationType == value.getType()) {