Author: mukulg
Date: Tue Nov  9 14:07:45 2010
New Revision: 1032986

URL: http://svn.apache.org/viewvc?rev=1032986&view=rev
Log:
committing few fixes for the issue "allowing xs:group as child of xs:all for 
schema 1.1", as following:
1) minOccurs & maxOccurs must be 1 on group ref=""
2) corrections to few error messages and codes

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/XSDAbstractParticleTraverser.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=1032986&r1=1032985&r2=1032986&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
 Tue Nov  9 14:07:45 2010
@@ -187,7 +187,9 @@
         a-props-correct.3 = a-props-correct.3: Attribute ''{0}'' cannot use 
''fixed'' or ''default'', because the attribute''s '{'type definition'}' is ID, 
or is derived from ID.
         au-props-correct.2 = au-props-correct.2: In the attribute declaration 
of ''{0}'', a fixed value of ''{1}'' was specified. So if the attribute use 
referring to ''{0}'' also has a '{'value constraint'}', it must be fixed and 
its value must be ''{1}''.
         cos-all-limited.1.2 = cos-all-limited.1.2: An 'all' model group must 
appear in a particle with '{'min occurs'}' = '{'max occurs'}' = 1, and that 
particle must be part of a pair which constitutes the '{'content type'}' of a 
complex type definition.
+        cos-all-limited.1.3 = cos-all-limited.1.3: When an xs:group particle 
occurs as child of xs:all, then following condition must hold on xs:group 
particle, ''{min occurs} = {max occurs} = 1''.
         cos-all-limited.2 = cos-all-limited.2: The '{'max occurs'}' of an 
element in an ''all'' model group must be 0 or 1. The value ''{0}'' for element 
''{1}'' is invalid.
+        cos-all-limited.2-xs11 = cos-all-limited.2-xs11: Incorrect schema 
instruction ''{0}'' found as child of ''xs:all -> xs:group''. Only the 
compositor xs:all is permitted as child of ''xs:all -> xs:group''.         
         cos-applicable-facets = cos-applicable-facets: Facet ''{0}'' is not 
allowed by type {1}.
         cos-ct-extends.1.1 = cos-ct-extends.1.1: Type ''{0}'' was derived by 
extension from type ''{1}''.  However, the ''final'' attribute of ''{1}'' 
forbids derivation by extension.
         cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: The 
content type of a derived type and that of its base must both be mixed or both 
be element-only. Type ''{0}'' is element only, but its base type is not.
@@ -253,8 +255,7 @@
         maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: 
Error for type ''{2}''. The maxInclusive value =''{0}'' must be >= minInclusive 
of the base type ''{1}''.
         maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: 
Error for type ''{2}''. The maxInclusive value =''{0}'' must be > minExclusive 
of the base type ''{1}''.
         maxLength-valid-restriction = maxLength-valid-restriction: In the 
definition of {2}, maxLength value = ''{0}'' must be <= that of the base type 
''{1}''.
-        mg-props-correct.2 = mg-props-correct.2: Circular definitions detected 
for group ''{0}''. Recursively following the '{'term'}' values of the particles 
leads to a particle whose '{'term'}' is the group itself.
-        mg-props-correct.3 = mg-props-correct.3: Incorrect schema instruction 
''{0}'' found as child of ''xs:all -> xs:group''. Only the compositor xs:all is 
permitted as child of ''xs:all -> xs:group''.   
+        mg-props-correct.2 = mg-props-correct.2: Circular definitions detected 
for group ''{0}''. Recursively following the '{'term'}' values of the particles 
leads to a particle whose '{'term'}' is the group itself.           
         minExclusive-less-than-equal-to-maxExclusive = 
minExclusive-less-than-equal-to-maxExclusive: In the definition of {2}, 
minExclusive value = ''{0}'' must be <= maxExclusive value = ''{1}''.
         minExclusive-less-than-maxInclusive = 
minExclusive-less-than-maxInclusive: In the definition of {2}, minExclusive 
value = ''{0}'' must be < maxInclusive value = ''{1}''.
         minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: 
Error for type ''{2}''. The minExclusive value =''{0}'' must be >= minExclusive 
of the base type ''{1}''.

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java?rev=1032986&r1=1032985&r2=1032986&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractParticleTraverser.java
 Tue Nov  9 14:07:45 2010
@@ -26,6 +26,7 @@ import org.apache.xerces.impl.xs.XSParti
 import org.apache.xerces.impl.xs.util.XInt;
 import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.util.DOMUtil;
+import org.apache.xerces.xni.QName;
 import org.apache.xerces.xs.XSModelGroup;
 import org.apache.xerces.xs.XSObject;
 import org.apache.xerces.xs.XSObjectList;
@@ -105,6 +106,14 @@ abstract class XSDAbstractParticleTraver
                         }
                     }
                     else if (childName.equals(SchemaSymbols.ELT_GROUP)) {
+                        // check for the constraints on minOccurs and 
maxOccurs attributes of xs:group particle
+                        Object[] groupAttrValues = 
fAttrChecker.checkAttributes(child, false, schemaDoc);
+                        XInt  groupMinAttr = (XInt)  
groupAttrValues[XSAttributeChecker.ATTIDX_MINOCCURS];
+                        XInt  groupMaxAttr = (XInt)  
groupAttrValues[XSAttributeChecker.ATTIDX_MAXOCCURS];                        
+                        if (!(groupMinAttr.intValue() == 1 && 
groupMaxAttr.intValue() == 1)) {
+                            reportSchemaError("cos-all-limited.1.3", null, 
child);  
+                        }
+                        
                         particle = 
fSchemaHandler.fGroupTraverser.traverseLocal(child, schemaDoc, grammar);        
                                        
                         if (particle != null) {
                             expandGroupParticleForCompositorAll(particle, 
child); 
@@ -187,7 +196,7 @@ abstract class XSDAbstractParticleTraver
             String wrongCompsName = (group.getCompositor() == 
XSModelGroup.COMPOSITOR_SEQUENCE) ? 
                                      "xs:"+SchemaSymbols.ELT_SEQUENCE : 
"xs:"+SchemaSymbols.ELT_CHOICE;
             // it's an error to have a non-all (xs:all) compositor within 
"xs:all -> xs:group"
-            reportSchemaError("mg-props-correct.3", new Object[] { 
wrongCompsName }, contextElement);
+            reportSchemaError("cos-all-limited.2-xs11", new Object[] { 
wrongCompsName }, contextElement);
         }
         
     } // expandGroupParticleForCompositorAll



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to