DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12062>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12062 validating "All" group, once an error, will report all next tags invalid Summary: validating "All" group, once an error, will report all next tags invalid Product: Xerces2-J Version: 2.0.2 Platform: All OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: XML Schema Structures AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] See attached test files. Once the schema validation fails for the "all" group, in this test case on the t41 element, it will report all remaining elements invalid, even t2 which is valid. A quick look at the code shows that in XMLSchemaValidator (line 1794 in the latest cvs rev 1.87 of the file, see below) in the if statement adding a check for decl==null solves the problem. Reasoning behind the change: if I understand the code correctly, fCurrentCM.oneTransition() will return "null" if and only if the element does not match any of the allowed elements. Please make sure the proposed change does not have other side effects. Note: even after the fix there are still somewhat inconsistent error reporting (play with the t41, t42, and t43 tags and see how those are reported as errors, how the errors reported are restarted after every valid element), but my I think it is good enough and further checking will only slow down the validation process without signifficant benefit. Regards, Dave ---<where to patch: XMLSchemaValidator.java, cvs rev 1.87, line 1794>--- // if we are not skipping this element, and there is a content model, // we try to find the corresponding decl object for this element. // the reason we move this part of code here is to make sure the // error reported here (if any) is stored within the parent element's // context, instead of that of the current element. Object decl = null; if (fSkipValidationDepth < 0 && fCurrentCM != null) { decl = fCurrentCM.oneTransition(element, fCurrCMState, fSubGroupHandler); // it could be an element decl or a wildcard decl --->THIS LINE---> if (decl==null && fCurrCMState[0] == XSCMValidator.FIRST_ERROR && fDoValidation) { XSComplexTypeDecl ctype = (XSComplexTypeDecl)fCurrentType; //REVISIT: is it the only case we will have particle = null? if (ctype.fParticle != null) { reportSchemaError("cvc-complex-type.2.4.a", new Object[]{element.rawname, ctype.fParticle.toString()}); } else { reportSchemaError("cvc-complex-type.2.4.a", new Object[]{element.rawname, "mixed with no element content"}); } } } ---<this is the test.xml>--- <?xml version="1.0"?> <t xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd"> <tt> <t1>test1</t1> <t4>zzz</t4> <t3>test2</t3> </tt> <tt> <t3>test3</t3> <t1>test1</t1> <t41>zzz</t41> <t43>zzz</t43> <t2>test2</t2> <t42>zzz</t42> </tt> </t> ---<this is the test.xsd>--- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="z"> <xsd:all> <xsd:element name="t1"/> <xsd:element name="t2" minOccurs="0"/> <xsd:element name="t3"/> <xsd:element name="t4"/> </xsd:all> </xsd:complexType> <xsd:element name="t"> <xsd:complexType> <xsd:sequence> <xsd:element name="tt" type="z" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
