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 <gYear> datatype (W3C Schema Datatypes)
31 *
32 * @xerces.internal
33 *
34 * @author Elena Litani
35 * @author Gopal Sharma, SUN Microsystem Inc.
36 *
37 * @version $Id: YearDV.java,v 1.7 2010-11-01 04:39:47 joehw Exp $
38 */
39
40 public class YearDV extends AbstractDateTimeDV {
41
42 /**
43 * Convert a string to a compiled form
44 *
45 * @param content The lexical representation of time
46 * @return a valid and normalized time object
47 */
48 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
49 try{
50 return parse(content);
51 } catch(Exception ex){
52 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gYear"});
53 }
54 }
55
56 /**
57 * Parses, validates and computes normalized version of gYear object
|
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 <gYear> datatype (W3C Schema Datatypes)
31 *
32 * @xerces.internal
33 *
34 * @author Elena Litani
35 * @author Gopal Sharma, SUN Microsystem Inc.
36 *
37 */
38
39 public class YearDV extends AbstractDateTimeDV {
40
41 /**
42 * Convert a string to a compiled form
43 *
44 * @param content The lexical representation of time
45 * @return a valid and normalized time object
46 */
47 public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
48 try{
49 return parse(content);
50 } catch(Exception ex){
51 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gYear"});
52 }
53 }
54
55 /**
56 * Parses, validates and computes normalized version of gYear object
|