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