Author: mukulg
Date: Mon Apr 18 11:11:52 2011
New Revision: 1094489

URL: http://svn.apache.org/viewvc?rev=1094489&view=rev
Log:
Given the following XML document,

<X>
   <a/>
   <b/>
   <c/>
   <d/>
   <e/>
</X>

and this schema fragment used to validate element "X",

<xs:element name="X">
   <xs:complexType>
      <xs:sequence>
         <xs:any processContents="skip" maxOccurs="3"/>                   
      </xs:sequence>
   </xs:complexType>
</xs:element>

currently we get following error message, upon validation failure,

cvc-complex-type.2.4.f: 'd' can occur a maximum of '3' times in the current 
sequence. This limit was exceeded. No child element is expected at this point.

This is slightly confusing, since a wildcard validated the element instances.

I'm committing a slight improvement for this case, and we now get an error 
message as following for the above use case,

cvc-complex-type.2.4.f: 'WC[##any]' can occur a maximum of '3' times in the 
current sequence. This limit was exceeded. No child element is expected at this 
point.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1094489&r1=1094488&r2=1094489&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Mon 
Apr 18 11:11:52 2011
@@ -1990,7 +1990,7 @@ public class XMLSchemaValidator
                         final int count = occurenceInfo[2];
                         // Check if this is a violation of maxOccurs
                         if (count >= maxOccurs && maxOccurs != 
SchemaSymbols.OCCURRENCE_UNBOUNDED) {
-                            reportSchemaError("cvc-complex-type.2.4.f", new 
Object[] { element.rawname, Integer.toString(maxOccurs) });
+                            reportSchemaError("cvc-complex-type.2.4.f", new 
Object[] { fCurrentCM.getTermName(occurenceInfo[3]), 
Integer.toString(maxOccurs) });
                         }
                         else {
                             reportSchemaError("cvc-complex-type.2.4.d", new 
Object[] { element.rawname });



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

Reply via email to