Author: mukulg
Date: Mon Apr 18 11:11:00 2011
New Revision: 1094488
URL: http://svn.apache.org/viewvc?rev=1094488&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/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1094488&r1=1094487&r2=1094488&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Mon Apr 18 11:11:00 2011
@@ -2085,8 +2085,8 @@ public class XMLSchemaValidator
final int maxOccurs = occurenceInfo[1];
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) });
+ if (count >= maxOccurs && maxOccurs !=
SchemaSymbols.OCCURRENCE_UNBOUNDED) {
+ 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]