YearMonthDVpublic class YearMonthDV extends AbstractDateTimeDV Validator for <gYearMonth> datatype (W3C Schema Datatypes) |
Methods Summary |
---|
protected java.lang.String | dateToString(DateTimeData date)
StringBuffer message = new StringBuffer(25);
append(message, date.year, 4);
message.append('-");
append(message, date.month, 2);
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, "gYearMonth"});
}
| protected javax.xml.datatype.XMLGregorianCalendar | getXMLGregorianCalendar(DateTimeData date)
return factory.newXMLGregorianCalendar(date.unNormYear, date.unNormMonth, DatatypeConstants.FIELD_UNDEFINED
, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, date.timezoneHr * 60 + date.timezoneMin);
| protected DateTimeData | parse(java.lang.String str)Parses, validates and computes normalized version of gYearMonth object
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
// get date
int end = getYearMonth(str, 0, len, date);
date.day = DAY;
parseTimeZone (str, end, len, date);
//validate and normalize
validateDateTime(date);
//save unnormalized values
saveUnnormalized(date);
if ( date.utc!=0 && date.utc!='Z" ) {
normalize(date);
}
date.position = 0;
return date;
|
|