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 2022/06/02 15:46:00 UTC
[jira] [Created] (XERCESJ-1746) improvements to error messages, while validating with XML Schema simple types
Mukul Gandhi created XERCESJ-1746:
-------------------------------------
Summary: improvements to error messages, while validating with XML Schema simple types
Key: XERCESJ-1746
URL: https://issues.apache.org/jira/browse/XERCESJ-1746
Project: Xerces2-J
Issue Type: Improvement
Components: XML Schema 1.0 Structures, XML Schema 1.1 Structures
Affects Versions: 2.12.2
Reporter: Mukul Gandhi
Please consider the following XML Schema validation examples.
XML instance document,
<?xml version="1.0"?>
<X>
<abc/>
</X>
XML Schema 1.0/1.1 document, that validates above mentioned XML instance document,
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="X" type="xs:integer"/>
</xs:schema>
Currently, the above mentioned XML Schema validation produces error messages like following,
[Error] test.xml:4:5: cvc-type.3.1.2: Element 'X' is a simple type, so it must have no element information item [children].
[Error] test.xml:4:5: cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.
[Error] test.xml:4:5: cvc-type.3.1.3: The value '' of element 'X' is not valid.
I propose, the following error message instead, for the above mentioned XML Schema validation (the 2nd and 3rd error messages above, doesn't seem to be accurate),
[Error] test.xml:4:5: cvc-type.3.1.2: Element 'X' has the simple type 'integer', so it must have no element information item [children].
Below is another, XML Schema (1.1 ) document, that validates the above mentioned XML instance document,
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="X">
<xs:alternative test="xs:boolean('false')" type="xs:integer"/>
<xs:alternative type="xs:error"/>
</xs:element>
</xs:schema>
Currently, the above mentioned XML Schema validation produces error messages like following,
[Error] test.xml:4:5: cvc-type.3.1.2: Element 'X' is a simple type, so it must have no element information item [children].
[Error] test.xml:4:5: cvc-datatype-valid.1.2.1: '' is not a valid value for 'error'.
[Error] test.xml:4:5: cvc-type.3.1.3: The value '' of element 'X' is not valid.
I propose, the following error message instead, for the above mentioned XML Schema validation (the 2nd and 3rd error messages above, doesn't seem to be accurate),
[Error] test.xml:4:5: cvc-type.3.1.2: Element 'X' has the simple type 'error', so it must have no element information item [children].
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org