< prev index next >

src/com/sun/org/apache/xerces/internal/impl/dv/xs/DateDV.java

Print this page
rev 2127 : 8048021: Remove @version tag in jaxp repo
Reviewed-by: joehw


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




  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.impl.dv.xs;
  22 
  23 import javax.xml.datatype.DatatypeConstants;
  24 import javax.xml.datatype.XMLGregorianCalendar;
  25 
  26 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;
  27 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;
  28 
  29 /**
  30  * Validator for <date> datatype (W3C Schema datatypes)
  31  *
  32  * @xerces.internal
  33  *
  34  * @author Elena Litani
  35  * @author Gopal Sharma, SUN Microsystems Inc.
  36  *

  37  */
  38 public class DateDV extends DateTimeDV {
  39 
  40     public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
  41         try{
  42             return parse(content);
  43         } catch(Exception ex){
  44             throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "date"});
  45         }
  46     }
  47 
  48     /**
  49      * Parses, validates and computes normalized version of dateTime object
  50      *
  51      * @param str    The lexical representation of dateTime object CCYY-MM-DD
  52      *               with possible time zone Z or (-),(+)hh:mm
  53      * @return normalized dateTime representation
  54      * @exception SchemaDateTimeException Invalid lexical representation
  55      */
  56     protected DateTimeData parse(String str) throws SchemaDateTimeException {


< prev index next >