You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2011/08/10 17:27:51 UTC
svn commit: r1156230 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: dv/
dv/xs/ validation/ xs/ xs/traversers/
Author: knoaman
Date: Wed Aug 10 15:27:50 2011
New Revision: 1156230
URL: http://svn.apache.org/viewvc?rev=1156230&view=rev
Log:
* No need to set an explicit boolean flag on ValidationContext to indicate the schema version. Use the TypeValidatorHelper of the ValidationContext instead.
* Fix a bug in Date/Time validation for XML Schema 1.0 - current code was skipping the validation of the value if the version was 1.0.
* Make sure we always pass the XML Schema version when parsing a Date/Time value
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DayDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDayDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearMonthDV.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/ValidationContext.java Wed Aug 10 15:27:50 2011
@@ -64,9 +64,5 @@ public interface ValidationContext {
public Locale getLocale();
// TypeValidatorHelper
- public TypeValidatorHelper getTypeValidatorHelper();
-
- // indicating XML Schema 1.1 support
- public void setIsSchema11Context(boolean isSchema11Type);
- public boolean getIsSchema11Context();
+ public TypeValidatorHelper getTypeValidatorHelper();
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java Wed Aug 10 15:27:50 2011
@@ -408,14 +408,20 @@ public abstract class AbstractDateTimeDV
*
* @param data
*/
- protected void validateDateTime (DateTimeData data) {
+ protected void validateDateTime(DateTimeData data, boolean isSchema11Type) {
//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 (!isSchema11Type && 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
@@ -469,18 +475,6 @@ public abstract class AbstractDateTimeDV
}
- protected void validateDateTime (DateTimeData data, boolean isSchema11Type) {
- /**
- * XML Schema 1.1: Allow year 0000 in date related types.
- */
- if (isSchema11Type) {
- validateDateTime(data);
- }
- else if (!isSchema11Type && data.year==0) {
- throw new RuntimeException("The year \"0000\" is an illegal year value");
- }
- }
-
/**
* Return index of UTC char: 'Z', '+', '-'
*
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateDV.java Wed Aug 10 15:27:50 2011
@@ -37,7 +37,7 @@ public class DateDV extends DateTimeDV {
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "date"});
}
@@ -51,7 +51,7 @@ public class DateDV extends DateTimeDV {
* @return normalized dateTime representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException {
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException {
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -60,7 +60,7 @@ public class DateDV extends DateTimeDV {
//validate and normalize
//REVISIT: do we need SchemaDateTimeException?
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeDV.java Wed Aug 10 15:27:50 2011
@@ -37,12 +37,9 @@ import org.apache.xerces.impl.dv.Validat
*/
public class DateTimeDV extends AbstractDateTimeDV {
- private boolean fIsSchema11Context = false;
-
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try{
- fIsSchema11Context = context.getIsSchema11Context();
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTime"});
}
@@ -56,7 +53,7 @@ public class DateTimeDV extends Abstract
* @return normalized dateTime representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException {
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException {
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -76,7 +73,7 @@ public class DateTimeDV extends Abstract
//validate and normalize
//REVISIT: do we need SchemaDateTimeException?
- validateDateTime(date, fIsSchema11Context);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
@@ -87,10 +84,6 @@ public class DateTimeDV extends Abstract
return date;
}
- protected void setIsSchema11Context(boolean isSchema11Context) {
- fIsSchema11Context = isSchema11Context;
- }
-
protected XMLGregorianCalendar getXMLGregorianCalendar(DateTimeData date) {
return datatypeFactory.newXMLGregorianCalendar(BigInteger.valueOf(date.unNormYear), date.unNormMonth,
date.unNormDay, date.unNormHour, date.unNormMinute,
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DateTimeStampDV.java Wed Aug 10 15:27:50 2011
@@ -31,15 +31,14 @@ public class DateTimeStampDV extends Dat
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTimeStamp"});
}
}
- protected DateTimeData parse(String str) throws SchemaDateTimeException {
- setIsSchema11Context(true);
- DateTimeData parsedDateTime = super.parse(str);
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException {
+ DateTimeData parsedDateTime = super.parse(str, isXMLSchema11);
if (parsedDateTime.utc == 0) {
throw new RuntimeException("dateTimeStamp must have timezone");
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DayDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DayDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DayDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/DayDV.java Wed Aug 10 15:27:50 2011
@@ -39,7 +39,7 @@ public class DayDV extends AbstractDateT
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gDay"});
}
@@ -54,7 +54,7 @@ public class DayDV extends AbstractDateT
* @return normalized date representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException {
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException {
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -78,7 +78,7 @@ public class DayDV extends AbstractDateT
}
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDV.java Wed Aug 10 15:27:50 2011
@@ -44,7 +44,7 @@ public class MonthDV extends AbstractDat
*/
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gMonth"});
}
@@ -58,7 +58,7 @@ public class MonthDV extends AbstractDat
* @return normalized date representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException{
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException{
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -87,7 +87,7 @@ public class MonthDV extends AbstractDat
}
}
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDayDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDayDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDayDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/MonthDayDV.java Wed Aug 10 15:27:50 2011
@@ -47,7 +47,7 @@ public class MonthDayDV extends Abstract
*/
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gMonthDay"});
}
@@ -61,7 +61,7 @@ public class MonthDayDV extends Abstract
* @return normalized date representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException{
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException{
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -90,7 +90,7 @@ public class MonthDayDV extends Abstract
}
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TimeDV.java Wed Aug 10 15:27:50 2011
@@ -43,7 +43,7 @@ public class TimeDV extends AbstractDate
*/
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "time"});
}
@@ -58,7 +58,7 @@ public class TimeDV extends AbstractDate
* @return normalized time representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException{
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException{
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -71,7 +71,7 @@ public class TimeDV extends AbstractDate
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/TypeValidatorHelper.java Wed Aug 10 15:27:50 2011
@@ -71,6 +71,10 @@ public abstract class TypeValidatorHelpe
return fHelper1_1;
}
+ public boolean isXMLSchema11() {
+ return false;
+ }
+
public abstract int getAllowedFacets(short validationDV);
// Constructor
@@ -185,5 +189,9 @@ public abstract class TypeValidatorHelpe
public int getAllowedFacets(short validationDV) {
return (validationDV < fAllowedFacets.length) ? fAllowedFacets[validationDV] : FACETS_GROUP1;
}
+
+ public boolean isXMLSchema11() {
+ return true;
+ }
}
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Wed Aug 10 15:27:50 2011
@@ -243,13 +243,6 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
}
- public boolean getIsSchema11Context() {
- // TODO Auto-generated method stub
- return false;
- }
- public void setIsSchema11Context(boolean isSchema11Type) {
- // TODO Auto-generated method stub
- }
};
protected static TypeValidator[] getGDVs() {
@@ -3161,15 +3154,6 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return TypeValidatorHelper.getInstance(Constants.SCHEMA_VERSION_1_0);
}
-
- public boolean getIsSchema11Context() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void setIsSchema11Context(boolean isSchema11Type) {
- // TODO Auto-generated method stub
- }
};
private boolean fAnonymous = false;
@@ -3246,15 +3230,6 @@ public class XSSimpleTypeDecl implements
public TypeValidatorHelper getTypeValidatorHelper() {
return fExternal.getTypeValidatorHelper();
}
-
- public boolean getIsSchema11Context() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void setIsSchema11Context(boolean isSchema11Type) {
- // TODO Auto-generated method stub
- }
}
public void reset(){
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearDV.java Wed Aug 10 15:27:50 2011
@@ -44,7 +44,7 @@ public class YearDV extends AbstractDate
*/
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gYear"});
}
@@ -58,7 +58,7 @@ public class YearDV extends AbstractDate
* @return normalized date representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException{
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException{
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -90,7 +90,7 @@ public class YearDV extends AbstractDate
date.day=1;
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearMonthDV.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearMonthDV.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearMonthDV.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/YearMonthDV.java Wed Aug 10 15:27:50 2011
@@ -43,7 +43,7 @@ public class YearMonthDV extends Abstrac
*/
public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException{
try{
- return parse(content);
+ return parse(content, context.getTypeValidatorHelper().isXMLSchema11());
} catch(Exception ex){
throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "gYearMonth"});
}
@@ -57,7 +57,7 @@ public class YearMonthDV extends Abstrac
* @return normalized date representation
* @exception SchemaDateTimeException Invalid lexical representation
*/
- protected DateTimeData parse(String str) throws SchemaDateTimeException{
+ protected DateTimeData parse(String str, boolean isXMLSchema11) throws SchemaDateTimeException{
DateTimeData date = new DateTimeData(str, this);
int len = str.length();
@@ -68,7 +68,7 @@ public class YearMonthDV extends Abstrac
//validate and normalize
- validateDateTime(date);
+ validateDateTime(date, isXMLSchema11);
//save unnormalized values
saveUnnormalized(date);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/validation/ValidationState.java Wed Aug 10 15:27:50 2011
@@ -56,8 +56,6 @@ public class ValidationState implements
private final static Object fNullValue = new Object();
private TypeValidatorHelper fTypeValidatorHelper = null;
-
- private boolean fIsSchema11Context = false;
//
// public methods
@@ -217,12 +215,4 @@ public class ValidationState implements
public TypeValidatorHelper getTypeValidatorHelper() {
return fTypeValidatorHelper;
}
-
- public boolean getIsSchema11Context() {
- return fIsSchema11Context;
- }
-
- public void setIsSchema11Context(boolean isSchema11Context) {
- fIsSchema11Context = isSchema11Context;
- }
}
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Wed Aug 10 15:27:50 2011
@@ -756,8 +756,7 @@ public class XMLSchemaValidator
Augmentations augs)
throws XNIException {
- fValidationState.setNamespaceSupport(namespaceContext);
- fValidationState.setIsSchema11Context(fSchemaVersion == Constants.SCHEMA_VERSION_1_1);
+ fValidationState.setNamespaceSupport(namespaceContext);
fState4XsiType.setNamespaceSupport(namespaceContext);
fState4ApplyDefault.setNamespaceSupport(namespaceContext);
fLocator = locator;
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Wed Aug 10 15:27:50 2011
@@ -763,7 +763,6 @@ class XSDComplexTypeTraverser extends X
fXSSimpleType = fSchemaHandler.fDVFactory.createTypeRestriction(name,schemaDoc.fTargetNamespace,(short)0,baseValidator,null);
try{
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
- fValidationState.setIsSchema11Context(fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1);
fXSSimpleType.applyFacets(facetData, presentFacets, fixedFacets, fValidationState);
}catch(InvalidDatatypeFacetException ex){
reportSchemaError(ex.getKey(), ex.getArgs(), simpleContent);
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java?rev=1156230&r1=1156229&r2=1156230&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDSimpleTypeTraverser.java Wed Aug 10 15:27:50 2011
@@ -441,7 +441,6 @@ class XSDSimpleTypeTraverser extends XSD
try {
fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport);
- fValidationState.setIsSchema11Context(fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1);
newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState);
} catch (InvalidDatatypeFacetException ex) {
reportSchemaError(ex.getKey(), ex.getArgs(), child);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org