本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.Constants.SCHEMA_1_1_SUPPORT属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.SCHEMA_1_1_SUPPORT属性的具体用法?Java Constants.SCHEMA_1_1_SUPPORT怎么用?Java Constants.SCHEMA_1_1_SUPPORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xerces.internal.impl.Constants
的用法示例。
在下文中一共展示了Constants.SCHEMA_1_1_SUPPORT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrimitiveKind
public short getPrimitiveKind() {
if (fVariety == VARIETY_ATOMIC && fValidationDV != DV_ANYSIMPLETYPE) {
if (fValidationDV == DV_ID || fValidationDV == DV_IDREF || fValidationDV == DV_ENTITY) {
return DV_STRING;
}
else if (fValidationDV == DV_INTEGER) {
return DV_DECIMAL;
}
else if (Constants.SCHEMA_1_1_SUPPORT && (fValidationDV == DV_YEARMONTHDURATION || fValidationDV == DV_DAYTIMEDURATION)) {
return DV_DURATION;
}
else {
return fValidationDV;
}
}
else {
// REVISIT: error situation. runtime exception?
return (short)0;
}
}
示例2: getPrimitiveDV
private short getPrimitiveDV(short validationDV){
if (validationDV == DV_ID || validationDV == DV_IDREF || validationDV == DV_ENTITY){
return DV_STRING;
}
else if (validationDV == DV_INTEGER) {
return DV_DECIMAL;
}
else if (Constants.SCHEMA_1_1_SUPPORT && (validationDV == DV_YEARMONTHDURATION || validationDV == DV_DAYTIMEDURATION)) {
return DV_DURATION;
}
else {
return validationDV;
}
}
示例3: validateDateTime
/**
* Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601
* Conventions]
*
* @param data
*/
protected void validateDateTime(DateTimeData data) {
//REVISIT: should we throw an exception for not valid dates
// or reporting an error message should be sufficient?
/**
* XML Schema 1.1 - RQ-123: Allow year 0000 in date related types.
*/
if (!Constants.SCHEMA_1_1_SUPPORT && data.year == 0) {
throw new RuntimeException("The year \"0000\" is an illegal year value");
}
if (data.month < 1 || data.month > 12) {
throw new RuntimeException("The month must have values 1 to 12");
}
//validate days
if (data.day > maxDayInMonthFor(data.year, data.month) || data.day < 1) {
throw new RuntimeException("The day must have values 1 to 31");
}
//validate hours
if (data.hour > 23 || data.hour < 0) {
if (data.hour == 24 && data.minute == 0 && data.second == 0) {
data.hour = 0;
if (++data.day > maxDayInMonthFor(data.year, data.month)) {
data.day = 1;
if (++data.month > 12) {
data.month = 1;
if (Constants.SCHEMA_1_1_SUPPORT) {
++data.year;
} else if (++data.year == 0) {
data.year = 1;
}
}
}
} else {
throw new RuntimeException("Hour must have values 0-23, unless 24:00:00");
}
}
//validate
if (data.minute > 59 || data.minute < 0) {
throw new RuntimeException("Minute must have values 0-59");
}
//validate
if (data.second >= 60 || data.second < 0) {
throw new RuntimeException("Second must have values 0-59");
}
//validate
if (data.timezoneHr > 14 || data.timezoneHr < -14) {
throw new RuntimeException("Time zone should have range -14:00 to +14:00");
} else {
if ((data.timezoneHr == 14 || data.timezoneHr == -14) && data.timezoneMin != 0) {
throw new RuntimeException("Time zone should have range -14:00 to +14:00");
} else if (data.timezoneMin > 59 || data.timezoneMin < -59) {
throw new RuntimeException("Minute must have values 0-59");
}
}
}
示例4: normalize
/**
* If timezone present - normalize dateTime [E Adding durations to
* dateTimes]
*
* @param date CCYY-MM-DDThh:mm:ss+03
*/
protected void normalize(DateTimeData date) {
// REVISIT: we have common code in addDuration() for durations
// should consider reorganizing it.
//
//add minutes (from time zone)
int negate = -1;
if (DEBUG) {
System.out.println("==>date.minute" + date.minute);
System.out.println("==>date.timezoneMin" + date.timezoneMin);
}
int temp = date.minute + negate * date.timezoneMin;
int carry = fQuotient(temp, 60);
date.minute = mod(temp, 60, carry);
if (DEBUG) {
System.out.println("==>carry: " + carry);
}
//add hours
temp = date.hour + negate * date.timezoneHr + carry;
carry = fQuotient(temp, 24);
date.hour = mod(temp, 24, carry);
if (DEBUG) {
System.out.println("==>date.hour" + date.hour);
System.out.println("==>carry: " + carry);
}
date.day = date.day + carry;
while (true) {
temp = maxDayInMonthFor(date.year, date.month);
if (date.day < 1) {
date.day = date.day + maxDayInMonthFor(date.year, date.month - 1);
carry = -1;
} else if (date.day > temp) {
date.day = date.day - temp;
carry = 1;
} else {
break;
}
temp = date.month + carry;
date.month = modulo(temp, 1, 13);
date.year = date.year + fQuotient(temp, 1, 13);
if (date.year == 0 && !Constants.SCHEMA_1_1_SUPPORT) {
date.year = (date.timezoneHr < 0 || date.timezoneMin < 0) ? 1 : -1;
}
}
date.utc = 'Z';
}