You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2011/03/21 16:15:38 UTC

svn commit: r1083824 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java

Author: mukulg
Date: Mon Mar 21 15:15:38 2011
New Revision: 1083824

URL: http://svn.apache.org/viewvc?rev=1083824&view=rev
Log:
committing a slight fix for schema 1.1 assertions. when complexType's with simpleContent are derived by extension, the earlier codebase in SVN evaluated certain assertions twice. this commit solves this problem. 

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java?rev=1083824&r1=1083823&r2=1083824&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java Mon Mar 21 15:15:38 2011
@@ -38,6 +38,7 @@ import org.apache.xerces.xni.XMLAttribut
 import org.apache.xerces.xni.XMLString;
 import org.apache.xerces.xni.XNIException;
 import org.apache.xerces.xs.XSComplexTypeDefinition;
+import org.apache.xerces.xs.XSConstants;
 import org.apache.xerces.xs.XSMultiValueFacet;
 import org.apache.xerces.xs.XSObjectList;
 import org.apache.xerces.xs.XSSimpleTypeDefinition;
@@ -183,20 +184,21 @@ public class XSDAssertionValidator {
 
         // add assertion facets from "complexType -> simpleContent -> restriction"
         XSSimpleTypeDefinition simpleContentType = complexTypeDef.getSimpleType();
-        if (simpleContentType != null) {            
+        if (simpleContentType != null && complexTypeDef.getDerivationMethod() == XSConstants.DERIVATION_RESTRICTION) {
             Vector simpleContentAsserts = XSTypeHelper.getAssertsFromSimpleType(simpleContentType);
             for (int assertIdx = 0; assertIdx < simpleContentAsserts.size(); assertIdx++) {
                 XSAssert simpleContentAssert = (XSAssert) simpleContentAsserts.get(assertIdx);
                 complexTypeAsserts.addXSObject(simpleContentAssert);
-            }
+            } 
         }
+        
 
         // find assertions from attributes of a complex type, and add them to the parent assertions list
         XSObjectListImpl attrAsserts = getAssertsFromAttributes(attributes);
         final int attrAssertCount = attrAsserts.getLength(); 
         for (int attrAssertIdx = 0; attrAssertIdx < attrAssertCount; attrAssertIdx++) {
             complexTypeAsserts.addXSObject(attrAsserts.item(attrAssertIdx)); 
-        }        
+        }
         if (attrAssertCount > 0) {
            fAttributesHaveAsserts = true;  
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org