Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1746

improvements to error messages, while validating with XML Schema simple types

    XMLWordPrintableJSON

Details

    Description

      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].

      Attachments

        Activity

          People

            mukul_gandhi Mukul Gandhi
            mukul_gandhi Mukul Gandhi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: