TimeDVpublic class TimeDV extends AbstractDateTimeDV Validator for <time> datatype (W3C Schema Datatypes) |
Methods Summary |
---|
protected java.lang.String | dateToString(DateTimeData date)Converts time object representation to String
StringBuffer message = new StringBuffer(16);
append(message, date.hour, 2);
message.append(':");
append(message, date.minute, 2);
message.append(':");
append(message, date.second);
append(message, (char)date.utc, 0);
return message.toString();
| public java.lang.Object | getActualValue(java.lang.String content, com.sun.org.apache.xerces.internal.impl.dv.ValidationContext context)Convert a string to a compiled form
try{
return parse(content);
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "time"});
}
| protected javax.xml.datatype.XMLGregorianCalendar | getXMLGregorianCalendar(DateTimeData date)
return factory.newXMLGregorianCalendar(null
, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, date.unNormHour, date.unNormMinute, (int)date.unNormSecond, date.unNormSecond != 0?new BigDecimal(date.unNormSecond - ((int)date.unNormSecond)):null, date.timezoneHr * 60 + date.timezoneMin);
| protected DateTimeData | parse(java.lang.String str)Parses, validates and computes normalized version of time object
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
// time
// initialize to default values
date.year=YEAR;
date.month=MONTH;
date.day=15;
getTime(str, 0, len, date);
//validate and normalize
validateDateTime(date);
//save unnormalized values
saveUnnormalized(date);
if ( date.utc!=0 && date.utc != 'Z") {
normalize(date);
}
date.position = 2;
return date;
|
|