svn commit: r1328734 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java

2012-04-21 Thread mukulg
Author: mukulg
Date: Sat Apr 21 20:47:17 2012
New Revision: 1328734

URL: http://svn.apache.org/viewvc?rev=1328734view=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=1328734r1=1328733r2=1328734view=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: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org



svn commit: r1328735 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java

2012-04-21 Thread mukulg
Author: mukulg
Date: Sat Apr 21 20:49:58 2012
New Revision: 1328735

URL: http://svn.apache.org/viewvc?rev=1328735view=rev
Log:
committing the same fix on trunk, for the commit that was made a moment ago on 
the schema-dev-1.1 branch.

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=1328735r1=1328734r2=1328735view=diff
==
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Sat 
Apr 21 20:49:58 2012
@@ -2106,6 +2106,14 @@ public class XMLSchemaValidator
 xsiType = attributes.getValue(SchemaSymbols.URI_XSI, 
SchemaSymbols.XSI_TYPE);
 }
 
+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 no decl/type found for the current element
 if (fCurrentType == null  xsiType == null) {
 // if this is the validation root, report an error, because



-
To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org