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

2011-11-23 Thread mukulg
Author: mukulg
Date: Wed Nov 23 10:43:29 2011
New Revision: 1205359

URL: http://svn.apache.org/viewvc?rev=1205359view=rev
Log:
in some cases, XSD 1.1 assertion evaluations produce a lengthy and undesirable 
stack trace on standard output. i'm providing a quick fix for this problem (by 
suppressing the java exception).

here's a test case for this,

XML document:

Xg/X

schema document fragment:

xs:element name=X
   xs:simpleType
  xs:restriction base=xs:integer
 xs:assertion test=$value mod 2 = 0/
  /xs:restriction
   /xs:simpleType
/xs:element

before this fix, Xerces produced following output when above validation was 
invoked,

[Error] test.xml:1:9: cvc-datatype-valid.1.2.1: 'g' is not a valid value for 
'integer'.
[Error] test.xml:1:9: cvc-type.3.1.3: The value 'g' of element 'X' is not valid.
error: Parse error occurred - For input string: g
java.lang.NumberFormatException: For input string: g
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.math.BigInteger.init(Unknown Source)
...

This commit improves the error message that's produced in such cases.

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=1205359r1=1205358r2=1205359view=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
 Wed Nov 23 10:43:29 2011
@@ -2739,7 +2739,12 @@ public class XMLSchemaValidator
 
 // delegate to assertions validator subcomponent
 if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
-assertionValidatorEndElementDelegate(element);
+try {
+   assertionValidatorEndElementDelegate(element); 
+}
+catch(Exception ex) {
+   // NO OP  
+}
 }
 
 // Check if we should modify the xsi:type ignore depth



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



svn commit: r1205718 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDComplexTypeTraverser.java

2011-11-23 Thread mukulg
Author: mukulg
Date: Thu Nov 24 03:52:18 2011
New Revision: 1205718

URL: http://svn.apache.org/viewvc?rev=1205718view=rev
Log:
defining a missing error code in schema 1.1 properties file.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1205718r1=1205717r2=1205718view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 Thu Nov 24 03:52:18 2011
@@ -185,7 +185,8 @@
 src-type-alternative.3.12.13.1 = src-type-alternative.3.12.13.1: Type 
atlernative has both a ''type'' attribute and a ''anonymous type'' child. Only 
one of these is allowed for a type alternative.
 src-type-alternative.3.12.13.2 = src-type-alternative.3.12.13.2: Type 
definition missing for type atlernative. A ''type'' attribute, or a 
''complexType'' child element, or a ''simpleType'' child element must be 
present.
 src-wildcard.1 = src-wildcard.1: The properties ''namespace'' and 
''notNamespace'' cannot both be present in a wildcard declaration. Use only one 
of them.
-src-cip.1 = src-cip.1: The attribute ''{0}'' does not belong to schema 
versioning namespace (http://www.w3.org/2007/XMLSchema-versioning). Only 
following attributes are available for schema versioning namespace : 
''minVersion'', ''maxVersion'', ''typeAvailable'', ''typeUnavailable'', 
''facetAvailable'' and ''facetUnavailable''.  
+src-cip.1 = src-cip.1: The attribute ''{0}'' does not belong to schema 
versioning namespace (http://www.w3.org/2007/XMLSchema-versioning). Only 
following attributes are available for schema versioning namespace : 
''minVersion'', ''maxVersion'', ''typeAvailable'', ''typeUnavailable'', 
''facetAvailable'' and ''facetUnavailable''.
+src-assert.3.13.1 = src-assert.3.13.1: The mandatory attribute 
''test'' does not appear on the element ''assert'', within type definition 
''{0}''.  
 
 #constraint valid (3.X.6)
 

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1205718r1=1205717r2=1205718view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 Thu Nov 24 03:52:18 2011
@@ -42,6 +42,7 @@ import org.apache.xerces.impl.xs.asserti
 import org.apache.xerces.impl.xs.assertion.XSAssertImpl;
 import org.apache.xerces.impl.xs.util.XInt;
 import org.apache.xerces.impl.xs.util.XSObjectListImpl;
+import org.apache.xerces.impl.xs.util.XSTypeHelper;
 import org.apache.xerces.util.DOMUtil;
 import org.apache.xerces.util.XMLChar;
 import org.apache.xerces.util.XMLSymbols;
@@ -1758,8 +1759,8 @@ class  XSDComplexTypeTraverser extends X
 }
 }
 } else {
-// 'test' attribute is mandatory in an assert element
-reportSchemaError(src-assert.3.13.1, new Object[] { 
DOMUtil.getLocalName(assertElement) }, assertElement);
+// 'test' attribute is mandatory on an assert element
+reportSchemaError(src-assert.3.13.1, new Object[] { 
XSTypeHelper.getSchemaTypeName(enclosingCT) }, assertElement);
 }
 
 fAttrChecker.returnAttrArray(attrValues, schemaDoc);



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



svn commit: r1205731 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/traversers/XSDAbstractTraverser.java xs/traversers/XSDComplexTypeTrav

2011-11-23 Thread mukulg
Author: mukulg
Date: Thu Nov 24 06:11:12 2011
New Revision: 1205731

URL: http://svn.apache.org/viewvc?rev=1205731view=rev
Log:
making changes to implement the schema 1.1 error code src-assert.3.13.1 
consistently for assert and assertion.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1205731r1=1205730r2=1205731view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 Thu Nov 24 06:11:12 2011
@@ -186,7 +186,7 @@
 src-type-alternative.3.12.13.2 = src-type-alternative.3.12.13.2: Type 
definition missing for type atlernative. A ''type'' attribute, or a 
''complexType'' child element, or a ''simpleType'' child element must be 
present.
 src-wildcard.1 = src-wildcard.1: The properties ''namespace'' and 
''notNamespace'' cannot both be present in a wildcard declaration. Use only one 
of them.
 src-cip.1 = src-cip.1: The attribute ''{0}'' does not belong to schema 
versioning namespace (http://www.w3.org/2007/XMLSchema-versioning). Only 
following attributes are available for schema versioning namespace : 
''minVersion'', ''maxVersion'', ''typeAvailable'', ''typeUnavailable'', 
''facetAvailable'' and ''facetUnavailable''.
-src-assert.3.13.1 = src-assert.3.13.1: The mandatory attribute 
''test'' does not appear on the element ''assert'', within type definition 
''{0}''.  
+src-assert.3.13.1 = src-assert.3.13.1: The mandatory attribute 
''test'' does not appear on the element ''{0}'', within type definition 
''{1}''.  
 
 #constraint valid (3.X.6)
 

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=1205731r1=1205730r2=1205731view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
 Thu Nov 24 06:11:12 2011
@@ -38,6 +38,7 @@ import org.apache.xerces.impl.xs.asserti
 import org.apache.xerces.impl.xs.assertion.XSAssertImpl;
 import org.apache.xerces.impl.xs.util.XInt;
 import org.apache.xerces.impl.xs.util.XSObjectListImpl;
+import org.apache.xerces.impl.xs.util.XSTypeHelper;
 import org.apache.xerces.util.DOMUtil;
 import org.apache.xerces.util.NamespaceSupport;
 import org.apache.xerces.util.SymbolTable;
@@ -535,10 +536,8 @@ abstract class XSDAbstractTraverser {
 // add assertion object, to the list of assertions to be 
processed
 assertData.addElement(assertImpl);
 } else {
-// 'test' attribute is mandatory in assert element
-reportSchemaError(src-assert.3.13.1,
-new Object[] { DOMUtil.getLocalName(content) },
-content);
+// 'test' attribute is mandatory on an assertion element
+reportSchemaError(src-assert.3.13.1, new Object[] { 
DOMUtil.getLocalName(content), XSTypeHelper.getSchemaTypeName(typeDef) }, 
content);
 }
 } else {
 if (facet.equals(SchemaSymbols.ELT_MINLENGTH)) {

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1205731r1=1205730r2=1205731view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
 Thu Nov 24 06:11:12 2011
@@ -1759,8 +1759,8 @@ class  XSDComplexTypeTraverser extends X
 }
 }
 } else {
-// 'test' attribute is