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/01/13 15:29:19 UTC

svn commit: r1058581 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDComplexTypeTraverser.java

Author: knoaman
Date: Thu Jan 13 14:29:18 2011
New Revision: 1058581

URL: http://svn.apache.org/viewvc?rev=1058581&view=rev
Log:
Schema Representation Constraint: Complex Type Definition Representation OK
4. If the <complexContent> alternative is chosen and the mixed [attribute] is present on both <complexType> and <complexContent>, then actual values of those [attributes] must be the same.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1058581&r1=1058580&r2=1058581&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties Thu Jan 13 14:29:18 2011
@@ -132,6 +132,7 @@
         src-ct.4 = src-ct.4: Complex Type Definition Representation Error for type ''{0}''. The intersection of wildcards is not expressible.
         src-ct.5 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. The union of wildcards is not expressible.
         src-ct.6 = src-ct.5: Complex Type Definition Representation Error for type ''{0}''. If <openContent> is present and the actual value of its mode [attribute] is not 'none', then there must be an <any> among the [children] of <openContent>.
+        src-ct11.4 = src-ct11.4: Complex Type Definition Representation Error for type ''{0}''. If the <complexContent> alternative is chosen and the 'mixed' attribute is present on both <complexType> and <complexContent>, then the actual values of those attributes must be the same.
         src-element.1 = src-element.1: The properties ''default'' and ''fixed'' cannot both be present in element declaration ''{0}''. Use only one of them.
         src-element.2.1 = src-element.2.1: : One of 'ref' or 'name' must be present in a local element declaration.
         src-element.2.2 = src-element.2.2: Since ''{0}'' contains the ''ref'' attribute, its content must match (annotation?). However, ''{1}'' was found.

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=1058581&r1=1058580&r2=1058581&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 Thu Jan 13 14:29:18 2011
@@ -435,8 +435,10 @@ class  XSDComplexTypeTraverser extends X
             }
             else if (DOMUtil.getLocalName(child).equals
                     (SchemaSymbols.ELT_COMPLEXCONTENT)) {
+                final boolean mixedAttPresent = (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1)
+                    ? DOMUtil.getAttr(complexTypeDecl, SchemaSymbols.ATT_MIXED) != null : false;
                 traverseComplexContent(child, mixedAtt.booleanValue(),
-                        schemaDoc, grammar);
+                        mixedAttPresent, schemaDoc, grammar);
                 Element elemTmp = DOMUtil.getNextSiblingElement(child);
                 if (elemTmp != null) {
                     String siblingName = DOMUtil.getLocalName(elemTmp);
@@ -885,8 +887,8 @@ class  XSDComplexTypeTraverser extends X
     }
     
     private void traverseComplexContent(Element complexContentElement,
-            boolean mixedOnType, XSDocumentInfo schemaDoc,
-            SchemaGrammar grammar)
+            boolean mixedOnType, boolean mixedOnTypePresent, 
+            XSDocumentInfo schemaDoc, SchemaGrammar grammar)
     throws ComplexTypeRecoverableError {
         
         Object[] complexContentAttrValues = fAttrChecker.checkAttributes(complexContentElement, false,
@@ -899,6 +901,11 @@ class  XSDComplexTypeTraverser extends X
         Boolean mixedAtt     = (Boolean) complexContentAttrValues[XSAttributeChecker.ATTIDX_MIXED];
         if (mixedAtt != null) {
             mixedContent = mixedAtt.booleanValue();
+            if (mixedOnTypePresent && mixedContent != mixedOnType) {
+                fAttrChecker.returnAttrArray(complexContentAttrValues, schemaDoc);
+                throw new ComplexTypeRecoverableError("src-ct11.4",
+                        new Object[]{fName}, complexContentElement);
+            }
         }        
 
         // -----------------------------------------------------------------------



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