You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2010/11/05 20:51:45 UTC
svn commit: r1031751 -
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
Author: sandygao
Date: Fri Nov 5 19:51:44 2010
New Revision: 1031751
URL: http://svn.apache.org/viewvc?rev=1031751&view=rev
Log:
Bug fix: in checking element-element collision in schema 1.1 UPA, need to make sure the 2 element's substitution groups don't overlap, because the same element can have multiple substitution affiliations. e.g. if "e" substitutes both "a" and "b", then (a|b) should be marked as UPA violation.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java?rev=1031751&r1=1031750&r2=1031751&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSConstraints.java Fri Nov 5 19:51:44 2010
@@ -556,24 +556,34 @@ public abstract class XSConstraints {
// or if there is an element decl in element1's substitution group,
// who has the same name/namespace with element2
- XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(element1, fSchemaVersion);
- for (int i = subGroup.length-1; i >= 0; i--) {
- if (subGroup[i].fName == element2.fName &&
- subGroup[i].fTargetNamespace == element2.fTargetNamespace) {
+ XSElementDecl[] subGroup1 = sgHandler.getSubstitutionGroup(element1, fSchemaVersion);
+ for (int i = subGroup1.length-1; i >= 0; i--) {
+ if (subGroup1[i].fName == element2.fName &&
+ subGroup1[i].fTargetNamespace == element2.fTargetNamespace) {
return true;
}
}
// or if there is an element decl in element2's substitution group,
// who has the same name/namespace with element1
- subGroup = sgHandler.getSubstitutionGroup(element2, fSchemaVersion);
- for (int i = subGroup.length-1; i >= 0; i--) {
- if (subGroup[i].fName == element1.fName &&
- subGroup[i].fTargetNamespace == element1.fTargetNamespace) {
+ XSElementDecl[] subGroup2 = sgHandler.getSubstitutionGroup(element2, fSchemaVersion);
+ for (int i = subGroup2.length-1; i >= 0; i--) {
+ if (subGroup2[i].fName == element1.fName &&
+ subGroup2[i].fTargetNamespace == element1.fTargetNamespace) {
return true;
}
}
+ // or if the 2 substitution groups overlap.
+ for (int i = subGroup1.length-1; i >= 0; i--) {
+ for (int j = subGroup2.length-1; j >= 0; j--) {
+ if (subGroup1[i].fName == subGroup2[i].fName &&
+ subGroup1[i].fTargetNamespace == subGroup2[i].fTargetNamespace) {
+ return true;
+ }
+ }
+ }
+
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org