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