1 57 58 package com.sun.org.apache.xerces.internal.impl.dv.xs; 59 60 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; 61 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; 62 63 71 public class DateTimeDV extends AbstractDateTimeDV { 72 73 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException { 74 try{ 75 return new DateTimeData(parse(content), this); 76 } catch(Exception ex){ 77 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object []{content, "dateTime"}); 78 } 79 } 80 81 90 protected int[] parse(String str) throws SchemaDateTimeException { 91 int len = str.length(); 92 int[] date = new int[TOTAL_SIZE]; 93 int[] timeZone = new int[2]; 94 95 int end = indexOf (str, 0, len, 'T'); 96 97 getDate(str, 0, end, date); 99 getTime(str, end+1, len, date, timeZone); 100 101 103 validateDateTime(date, timeZone); 105 106 if ( date[utc]!=0 && date[utc]!='Z') { 107 normalize(date, timeZone); 108 } 109 return date; 110 } 111 112 } 113 | Popular Tags |