19 */
20
21 package com.sun.org.apache.xerces.internal.impl.dv.xs;
22
23 import java.math.BigInteger;
24
25 import javax.xml.datatype.DatatypeConstants;
26 import javax.xml.datatype.XMLGregorianCalendar;
27
28 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
29 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
30
31 /**
32 * Validator for <dateTime> datatype (W3C Schema Datatypes)
33 *
34 * @xerces.internal
35 *
36 * @author Elena Litani
37 * @author Gopal Sharma, SUN Microsystem Inc.
38 *
39 * @version $Id: DateTimeDV.java,v 1.7 2010-11-01 04:39:46 joehw Exp $
40 */
41 public class DateTimeDV extends AbstractDateTimeDV {
42
43 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
44 try{
45 return parse(content);
46 } catch(Exception ex){
47 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTime"});
48 }
49 }
50
51 /**
52 * Parses, validates and computes normalized version of dateTime object
53 *
54 * @param str The lexical representation of dateTime object CCYY-MM-DDThh:mm:ss.sss
55 * with possible time zone Z or (-),(+)hh:mm
56 * @return normalized dateTime representation
57 * @exception SchemaDateTimeException Invalid lexical representation
58 */
59 protected DateTimeData parse(String str) throws SchemaDateTimeException {
|
19 */
20
21 package com.sun.org.apache.xerces.internal.impl.dv.xs;
22
23 import java.math.BigInteger;
24
25 import javax.xml.datatype.DatatypeConstants;
26 import javax.xml.datatype.XMLGregorianCalendar;
27
28 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
29 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
30
31 /**
32 * Validator for <dateTime> datatype (W3C Schema Datatypes)
33 *
34 * @xerces.internal
35 *
36 * @author Elena Litani
37 * @author Gopal Sharma, SUN Microsystem Inc.
38 *
39 */
40 public class DateTimeDV extends AbstractDateTimeDV {
41
42 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
43 try{
44 return parse(content);
45 } catch(Exception ex){
46 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTime"});
47 }
48 }
49
50 /**
51 * Parses, validates and computes normalized version of dateTime object
52 *
53 * @param str The lexical representation of dateTime object CCYY-MM-DDThh:mm:ss.sss
54 * with possible time zone Z or (-),(+)hh:mm
55 * @return normalized dateTime representation
56 * @exception SchemaDateTimeException Invalid lexical representation
57 */
58 protected DateTimeData parse(String str) throws SchemaDateTimeException {
|