FileDocCategorySizeDatePackage
DateTimeDV.javaAPI DocJava SE 5 API4555Fri Aug 26 14:55:48 BST 2005com.sun.org.apache.xerces.internal.impl.dv.xs

DateTimeDV

public class DateTimeDV extends AbstractDateTimeDV
Validator for datatype (W3C Schema Datatypes)
author
Elena Litani
author
Gopal Sharma, SUN Microsystem Inc.
version
$Id: DateTimeDV.java,v 1.6 2002/11/18 23:10:10 sandygao Exp $

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectgetActualValue(java.lang.String content, com.sun.org.apache.xerces.internal.impl.dv.ValidationContext context)

        try{
            return new DateTimeData(parse(content), this);
        } catch(Exception ex){
            throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTime"});
        }
    
protected int[]parse(java.lang.String str)
Parses, validates and computes normalized version of dateTime object

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

        int len = str.length();
        int[] date = new int[TOTAL_SIZE];
        int[] timeZone = new int[2];

        int end = indexOf (str, 0, len, 'T");

        // both time and date
        getDate(str, 0, end, date);
        getTime(str, end+1, len, date, timeZone);

        //validate and normalize

        //REVISIT: do we need SchemaDateTimeException?
        validateDateTime(date, timeZone);

        if ( date[utc]!=0 && date[utc]!='Z") {
            normalize(date, timeZone);
        }
        return date;