Author: mukulg
Date: Fri Oct 22 10:17:43 2021
New Revision: 1894472

URL: http://svn.apache.org/viewvc?rev=1894472&view=rev
Log:
committing fix for jira issue XERCESJ-1731

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/XMLSchemaValidator.java
    
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
    
xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.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=1894472&r1=1894471&r2=1894472&view=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
 Fri Oct 22 10:17:43 2021
@@ -70,6 +70,7 @@
         cvc-complex-type.3.2.1 = cvc-complex-type.3.2.1: Element ''{0}'' does 
not have an attribute wildcard for attribute ''{1}''.
         cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: Attribute ''{1}'' is 
not allowed to appear in element ''{0}''.
         cvc-complex-type.4 = cvc-complex-type.4: Attribute ''{1}'' must appear 
on element ''{0}''.
+        cvc-complex-type.4_ns = cvc-complex-type.4: Attribute ''{1}'' 
belonging to namespace ''{2}'', must appear on element ''{0}''.
         cvc-complex-type.5.1 = cvc-complex-type.5.1: In element ''{0}'', 
attribute ''{1}'' is a Wild ID. But there is already a Wild ID ''{2}''. There 
can be only one.
         cvc-complex-type.5.2 = cvc-complex-type.5.2: In element ''{0}'', 
attribute ''{1}'' is a Wild ID. But there is already an attribute ''{2}'' 
derived from ID among the '{'attribute uses'}'.
         cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' is not a 
valid value for ''{1}''.

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=1894472&r1=1894471&r2=1894472&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
 Fri Oct 22 10:17:43 2021
@@ -2793,10 +2793,18 @@ public class XMLSchemaValidator extends
             // {required} is true matches one of the attribute information 
items in the element
             // information item's [attributes] as per clause 3.1 above.
             if (currUse.fUse == SchemaSymbols.USE_REQUIRED) {
-                if (!isSpecified)                    
-                    reportSchemaError(
-                        "cvc-complex-type.4",
-                        new Object[] { element.rawname, currDecl.fName });
+                if (!isSpecified) {                    
+                    if (currDecl.fTargetNamespace != null) {
+                       reportSchemaError(
+                                "cvc-complex-type.4_ns",
+                                new Object[] { element.rawname, 
currDecl.fName, currDecl.fTargetNamespace });      
+                    }
+                    else {
+                       reportSchemaError(
+                                "cvc-complex-type.4",
+                                new Object[] { element.rawname, currDecl.fName 
});
+                    }                    
+                }
             }
             // if the attribute is not specified, then apply the value 
constraint
             if (!isSpecified && constType != XSConstants.VC_NONE) {

Modified: 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java?rev=1894472&r1=1894471&r2=1894472&view=diff
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
 (original)
+++ 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
 Fri Oct 22 10:17:43 2021
@@ -219,7 +219,7 @@ public class JiraBugsTests extends Xerce
             // test expected error messages
             List expectedMsgList = new ArrayList();
             FailureMesgFragments mesgFragments = new FailureMesgFragments();
-            mesgFragments.setMessageFragment("Attribute 'id' must appear on 
element 'el'");
+            mesgFragments.setMessageFragment("Attribute 'id' belonging to 
namespace 'tns', must appear on element 'el'");
             expectedMsgList.add(mesgFragments);
             assertTrue(areErrorMessagesConsistent(expectedMsgList));
                } catch(Exception ex) {
@@ -243,7 +243,7 @@ public class JiraBugsTests extends Xerce
             // test expected error messages
             List expectedMsgList = new ArrayList();
             FailureMesgFragments mesgFragments = new FailureMesgFragments();
-            mesgFragments.setMessageFragment("Attribute 'id' must appear on 
element 'el'");
+            mesgFragments.setMessageFragment("Attribute 'id' belonging to 
namespace 'tns', must appear on element 'el'");
             expectedMsgList.add(mesgFragments);
             assertTrue(areErrorMessagesConsistent(expectedMsgList));
                } catch(Exception ex) {

Modified: 
xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1894472&r1=1894471&r2=1894472&view=diff
==============================================================================
--- 
xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties 
(original)
+++ 
xerces/java/trunk/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties 
Fri Oct 22 10:17:43 2021
@@ -69,6 +69,7 @@
         cvc-complex-type.3.2.1 = cvc-complex-type.3.2.1: Element ''{0}'' does 
not have an attribute wildcard for attribute ''{1}''.
         cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: Attribute ''{1}'' is 
not allowed to appear in element ''{0}''.
         cvc-complex-type.4 = cvc-complex-type.4: Attribute ''{1}'' must appear 
on element ''{0}''.
+        cvc-complex-type.4_ns = cvc-complex-type.4: Attribute ''{1}'' 
belonging to namespace ''{2}'', must appear on element ''{0}''.
         cvc-complex-type.5.1 = cvc-complex-type.5.1: In element ''{0}'', 
attribute ''{1}'' is a Wild ID. But there is already a Wild ID ''{2}''. There 
can be only one.
         cvc-complex-type.5.2 = cvc-complex-type.5.2: In element ''{0}'', 
attribute ''{1}'' is a Wild ID. But there is already an attribute ''{2}'' 
derived from ID among the '{'attribute uses'}'.
         cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' is not a 
valid value for ''{1}''.

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=1894472&r1=1894471&r2=1894472&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Fri 
Oct 22 10:17:43 2021
@@ -3224,10 +3224,18 @@ public class XMLSchemaValidator
             // {required} is true matches one of the attribute information 
items in the element
             // information item's [attributes] as per clause 3.1 above.
             if (currUse.fUse == SchemaSymbols.USE_REQUIRED) {
-                if (!isSpecified)
-                    reportSchemaError(
-                        "cvc-complex-type.4",
-                        new Object[] { element.rawname, currDecl.fName });
+                if (!isSpecified) {                    
+                    if (currDecl.fTargetNamespace != null) {
+                       reportSchemaError(
+                                "cvc-complex-type.4_ns",
+                                new Object[] { element.rawname, 
currDecl.fName, currDecl.fTargetNamespace });      
+                    }
+                    else {
+                       reportSchemaError(
+                                "cvc-complex-type.4",
+                                new Object[] { element.rawname, currDecl.fName 
});
+                    }                    
+                }
             }
             // if the attribute is not specified, then apply the value 
constraint
             if (!isSpecified && constType != XSConstants.VC_NONE) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to