Author: mukulg
Date: Sat Apr 21 20:47:17 2012
New Revision: 1328734
URL: http://svn.apache.org/viewvc?rev=1328734&view=rev
Log:
committing fixes for the bug reported by "Jorge Williams", with Xerces's XSD
implementation (bug reference, http://markmail.org/message/ijlswam4n6jzb7zh).
this bug appears to occur both with Xerces's XSD 1.1 and 1.0 implementations.
this also appears to be not XSD 1.1 <assertion> specific, and appears to be
related to use of xsi:type and an schema element declaration not existing for
the root XML element.
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=1328734&r1=1328733&r2=1328734&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
Sat Apr 21 20:47:17 2012
@@ -2293,6 +2293,15 @@ public class XMLSchemaValidator
// if no decl/type found for the current element
final boolean isSchema11 = (fSchemaVersion ==
Constants.SCHEMA_VERSION_1_1);
boolean needToPushErrorContext = false;
+
+ if (fCurrentType == null && xsiType != null && fElementDepth == 0) {
+ fXSIErrorReporter.fErrorReporter.reportError(
+ XSMessageFormatter.SCHEMA_DOMAIN,
+ "cvc-elt.1.a",
+ new Object[] { element.rawname },
+ XMLErrorReporter.SEVERITY_ERROR);
+ }
+
if (fCurrentType == null && xsiType == null) {
// if this is the validation root, report an error, because
// we can't find eith decl or type for this element
@@ -2339,7 +2348,8 @@ public class XMLSchemaValidator
else if (wildcard != null && wildcard.fProcessContents ==
XSWildcardDecl.PC_STRICT) {
// report error, because wilcard = strict
reportSchemaError("cvc-complex-type.2.4.c", new Object[] {
element.rawname });
- }
+ }
+
// no element decl or type found for this element.
// Allowed by the spec, we can choose to either laxly assess this
// element, or to skip it. Now we choose lax assessment.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]