/** * Convert to target data type */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.SAXON_JAVA_LANG_OBJECT: return this; case StandardNames.XS_BOOLEAN: return BooleanValue.get( (value != null && value.toString().length() > 0)); case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: return new StringValue(getStringValue()).convertPrimitive(requiredType, validate, context); } }
/** * Convert to target data type */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.SAXON_JAVA_LANG_OBJECT: return this; case StandardNames.XS_BOOLEAN: return BooleanValue.get( (value != null && value.toString().length() > 0)); case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: return new StringValue(getStringValue()).convertPrimitive(requiredType, validate, context); } }
/** * Convert a QName to target data type * @param requiredType an integer identifying the required atomic type * @param context XPath dynamic context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.XS_QNAME: return this; case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: ValidationFailure err = new ValidationFailure("Cannot convert QName to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_DAY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gDay to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_MONTH: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gMonth to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert a QName to target data type * @param requiredType an integer identifying the required atomic type * @param context XPath dynamic context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.XS_QNAME: return this; case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: ValidationFailure err = new ValidationFailure("Cannot convert QName to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_MONTH: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gMonth to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_YEAR: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gYear to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_MONTH_DAY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gMonthDay to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_YEAR_MONTH: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gYearMonth to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context The XPath dynamic context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.XS_NOTATION: return this; case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: ValidationFailure err = new ValidationFailure("Cannot convert NOTATION to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_MONTH_DAY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gMonthDay to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * * @param requiredType an integer identifying the required atomic type * @param context XPath dynamic evaluation context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_TIME: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert time to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * * @param requiredType an integer identifying the required atomic type * @param context XPath dynamic evaluation context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_TIME: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert time to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context The XPath dynamic context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_ANY_ATOMIC_TYPE: case StandardNames.XS_NOTATION: return this; case StandardNames.XS_STRING: return new StringValue(getStringValue()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValue()); default: ValidationFailure err = new ValidationFailure("Cannot convert NOTATION to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_YEAR_MONTH: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gYearMonth to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_YEAR: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gYear to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch(requiredType.getPrimitiveType()) { case StandardNames.XS_G_DAY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); default: ValidationFailure err = new ValidationFailure("Cannot convert gDay to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * * @param requiredType an integer identifying the required atomic type * @param context XPath dynamic evaluation context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_HEX_BINARY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); case StandardNames.XS_BASE64_BINARY: return new Base64BinaryValue(binaryValue); default: ValidationFailure err = new ValidationFailure("Cannot convert hexBinarry to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }
/** * Convert to target data type * @param requiredType an integer identifying the required atomic type * @param context the XPath dynamic evaluation context * @return an AtomicValue, a value of the required type; or an ErrorValue */ public ConversionResult convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context) { switch (requiredType.getPrimitiveType()) { case StandardNames.XS_BASE64_BINARY: case StandardNames.XS_ANY_ATOMIC_TYPE: return this; case StandardNames.XS_STRING: return new StringValue(getStringValueCS()); case StandardNames.XS_UNTYPED_ATOMIC: return new UntypedAtomicValue(getStringValueCS()); case StandardNames.XS_HEX_BINARY: return new HexBinaryValue(binaryValue); default: ValidationFailure err = new ValidationFailure("Cannot convert base64Binary to " + requiredType.getDisplayName()); err.setErrorCode("XPTY0004"); return err; } }