You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Mukul Gandhi (Jira)" <xe...@xml.apache.org> on 2021/10/22 10:15:00 UTC

[jira] [Created] (XERCESJ-1731) XML Schema validation error message improvements, when XML attributes are validated

Mukul Gandhi created XERCESJ-1731:
-------------------------------------

             Summary: XML Schema validation error message improvements, when XML attributes are validated
                 Key: XERCESJ-1731
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1731
             Project: Xerces2-J
          Issue Type: Improvement
          Components: XML Schema 1.0 Structures, XML Schema 1.1 Structures
    Affects Versions: 2.12.1
            Reporter: Mukul Gandhi


I've been using the following XML Schema validation example, for this issue.

XML Schema document,

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                    elementFormDefault="qualified"
                    attributeFormDefault="qualified"
                    targetNamespace="http://ns0">

      <xs:element name="X">
           <xs:complexType>
               <xs:sequence>
                   <xs:element name="a" type="xs:string"/>
               </xs:sequence>
               <xs:attribute name="att1" type="xs:integer" use="required"/>
           </xs:complexType>
       </xs:element>

</xs:schema>

XML instance document, that's validated with above mentioned XML Schema document,

<?xml version="1.0"?>
<X xmlns="http://ns0" att1="105">
    <a>hello</a>
</X>

Upon doing, above mentioned XML Schema validation, XercesJ currently produces following two error messages,

cvc-complex-type.3.2.2: Attribute 'att1' is not allowed to appear in element 'X'.
cvc-complex-type.4: Attribute 'att1' must appear on element 'X'.

I find, above mentioned error messages little bit confusing.

I propose that, the second error message cited above should contain namespace information as well, something like following,

cvc-complex-type.4: Attribute 'att1' belonging to namespace 'http://ns0', must appear on element 'X'.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org