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/11 23:14:04 UTC

svn commit: r1156832 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: XS10Constraints.java XS11Constraints.java XSConstraints.java

Author: knoaman
Date: Thu Aug 11 21:14:03 2011
New Revision: 1156832

URL: http://svn.apache.org/viewvc?rev=1156832&view=rev
Log:
Apply rule 2.2.4.3 of Type Derivation OK (Simple)

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java
    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/XS10Constraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java?rev=1156832&r1=1156831&r2=1156832&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS10Constraints.java Thu Aug 11 21:14:03 2011
@@ -22,6 +22,7 @@ import java.util.Comparator;
 import java.util.Vector;
 
 import org.apache.xerces.impl.XMLErrorReporter;
+import org.apache.xerces.impl.dv.XSSimpleType;
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.util.SimpleLocator;
 import org.apache.xerces.xs.XSConstants;
@@ -1249,4 +1250,8 @@ class XS10Constraints extends XSConstrai
             throw new XMLSchemaException("rcase-MapAndSum.1", null);
         }
     }
+    
+    final protected boolean checkEmptyFacets(XSSimpleType baseType) {
+        return true;
+    }
 }

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java?rev=1156832&r1=1156831&r2=1156832&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XS11Constraints.java Thu Aug 11 21:14:03 2011
@@ -19,10 +19,12 @@ package org.apache.xerces.impl.xs;
 
 import org.apache.xerces.impl.Constants;
 import org.apache.xerces.impl.XMLErrorReporter;
+import org.apache.xerces.impl.dv.XSSimpleType;
 import org.apache.xerces.impl.xs.models.CMBuilder;
 import org.apache.xerces.impl.xs.models.XS11CMRestriction;
 import org.apache.xerces.impl.xs.models.XSCMValidator;
 import org.apache.xerces.impl.xs.util.SimpleLocator;
+import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.xni.QName;
 
 /**
@@ -421,5 +423,8 @@ class XS11Constraints extends XSConstrai
                     new Object[]{dType.fName});
         }
     }
-    
+
+    final protected boolean checkEmptyFacets(XSSimpleType baseType) {
+        return baseType.getMultiValueFacets() == XSObjectListImpl.EMPTY_LIST;
+    }
 }

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=1156832&r1=1156831&r2=1156832&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 Thu Aug 11 21:14:03 2011
@@ -192,12 +192,15 @@ public abstract class XSConstraints {
 
         // 2.2.4 B's {variety} is union and D is validly derived from a type definition in B's {member type definitions} given the subset, as defined by this constraint.
         if (base.getVariety() == XSSimpleType.VARIETY_UNION) {
-            XSObjectList subUnionMemberDV = base.getMemberTypes();
-            int subUnionSize = subUnionMemberDV.getLength();
-            for (int i=0; i<subUnionSize; i++) {
-                base = (XSSimpleType)subUnionMemberDV.item(i);
-                if (checkSimpleDerivation(derived, base, block))
-                    return true;
+            if (checkEmptyFacets(base)) {
+                XSObjectList subUnionMemberDV = base.getMemberTypes();
+                int subUnionSize = subUnionMemberDV.getLength();
+                for (int i=0; i<subUnionSize; i++) {
+                    base = (XSSimpleType)subUnionMemberDV.item(i);
+                    if (checkSimpleDerivation(derived, base, block)) {
+                        return true;
+                    }
+                }
             }
         }
 
@@ -829,6 +832,7 @@ public abstract class XSConstraints {
     public abstract boolean isSubsetOf(XSWildcardDecl wildcard, XSWildcardDecl superWildcard);
     public abstract XSWildcardDecl performUnionWith(XSWildcardDecl wildcard, XSWildcardDecl otherWildcard, short processContents);
     public abstract XSWildcardDecl performIntersectionWith(XSWildcardDecl wildcard, XSWildcardDecl otherWildcard, short processContents);
+    protected abstract boolean checkEmptyFacets(XSSimpleType baseType);
 
     // to check whether an element overlaps with a wildcard,
     // as defined in constraint UPA



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