private static Duration getDuration(DurationValue d, int type) { return XMLUtils.getXMLDuration(d.getStringValue(), type); }
/** * Convert to Java object (for passing to external functions) */ public Object convertToJava(Class target, XPathContext context) throws XPathException { if (target.isAssignableFrom(DurationValue.class)) { return this; } else if (target == String.class || target == CharSequence.class) { return getStringValue(); } else if (target == Object.class) { return getStringValue(); } else { Object o = super.convertToJava(target, context); if (o == null) { XPathException err = new XPathException("Conversion of xs:duration to " + target.getName() + " is not supported"); err.setXPathContext(context); err.setErrorCode(SaxonErrorCode.SXJE0003); } return o; } }
textVal = ISO8601DateParser.format((Date) simpleType); } else if (simpleType instanceof DurationValue) { textVal = ((DurationValue) simpleType).getStringValue(); } else { textVal = simpleType.toString();
textVal = ISO8601DateParser.format((Date) simpleType); } else if (simpleType instanceof DurationValue) { textVal = ((DurationValue)simpleType).getStringValue(); } else { textVal = simpleType.toString();