mrglavas 2005/06/08 21:48:32 Modified: java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java Log: Fixing JIRA Issue #1082: http://issues.apache.org/jira/browse/XERCESJ-1082 When checking whether the value of an attribute is equal to a value constraint we must check that their types are within the same value space. Revision Changes Path 1.173 +16 -6 xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Index: XMLSchemaValidator.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v retrieving revision 1.172 retrieving revision 1.173 diff -u -r1.172 -r1.173 --- XMLSchemaValidator.java 8 Jun 2005 22:14:48 -0000 1.172 +++ XMLSchemaValidator.java 9 Jun 2005 04:48:32 -0000 1.173 @@ -2757,7 +2757,7 @@ // get the value constraint from use or decl // 4 The item's actual value must match the value of the {value constraint}, if it is present and fixed. // now check the value against the simpleType if (actualValue != null && currDecl.getConstraintType() == XSConstants.VC_FIXED) { - if (!actualValue.equals(currDecl.fDefault.actualValue)) { + if (!isComparable(fValidatedInfo, currDecl.fDefault) || !actualValue.equals(currDecl.fDefault.actualValue)) { reportSchemaError( "cvc-attribute.4", new Object[] { @@ -2772,7 +2772,7 @@ if (actualValue != null && currUse != null && currUse.fConstraintType == XSConstants.VC_FIXED) { - if (!actualValue.equals(currUse.fDefault.actualValue)) { + if (!isComparable(fValidatedInfo, currDecl.fDefault) || !actualValue.equals(currUse.fDefault.actualValue)) { reportSchemaError( "cvc-complex-type.3.1", new Object[] { @@ -3155,9 +3155,19 @@ return false; } else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) { - final ShortList primitiveTypeList1 = convertToPrimitiveKind(info1.itemValueTypes); - final ShortList primitiveTypeList2 = convertToPrimitiveKind(info2.itemValueTypes); - return primitiveTypeList1.equals(primitiveTypeList2); + final ShortList typeList1 = info1.itemValueTypes; + final ShortList typeList2 = info2.itemValueTypes; + final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0; + final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0; + if (typeList1Length != typeList2Length) { + return false; + } + for (int i = 0; i < typeList1Length; ++i) { + if (convertToPrimitiveKind(typeList1.item(i)) != + convertToPrimitiveKind(typeList2.item(i))) { + return false; + } + } } return true; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
