FileDocCategorySizeDatePackage
YearMonthDV.javaAPI DocJava SE 6 API3419Tue Jun 10 00:22:42 BST 2008com.sun.org.apache.xerces.internal.impl.dv.xs

YearMonthDV

public class YearMonthDV extends AbstractDateTimeDV
Validator for <gYearMonth> datatype (W3C Schema Datatypes)
xerces.internal
author
Elena Litani
author
Gopal Sharma, SUN Microsystem Inc.
version
$Id: YearMonthDV.java,v 1.2.6.1 2005/09/06 11:43:10 neerajbj Exp $

Fields Summary
Constructors Summary
Methods Summary
protected java.lang.StringdateToString(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.ObjectgetActualValue(java.lang.String content, com.sun.org.apache.xerces.internal.impl.dv.ValidationContext context)
Convert a string to a compiled form

param
content The lexical representation of gYearMonth
return
a valid and normalized gYearMonth object

        try{
            return parse(content);
        } catch(Exception ex){
            throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gYearMonth"});
        }
    
protected javax.xml.datatype.XMLGregorianCalendargetXMLGregorianCalendar(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 DateTimeDataparse(java.lang.String str)
Parses, validates and computes normalized version of gYearMonth object

param
str The lexical representation of gYearMonth object CCYY-MM with possible time zone Z or (-),(+)hh:mm
return
normalized date representation
exception
SchemaDateTimeException Invalid lexical representation

        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;