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

enhancements to XML Schema 1.1 assertions run-time error messages

    XMLWordPrintableJSON

Details

    Description

      I committed sometime ago little enhancement to Xerces specific error messages during XML Schema 1.1 assertions evaluation failure (thought it would be ok to create a JIRA issue for this). Here are the summary of these changes (explained with a small example).

      instance document [1]:

      <x>101</x>

      XML Schema 1.1 simpleType definition [2]:

      <xs:simpleType>
      <xs:restriction base="xs:integer" xmlns:xerces="http://xerces.apache.org">
      <xs:assertion test="$value mod 2 = 0" xerces:message="The value must be divisible by 2. {$value} is not divisible by 2." />
      </xs:restriction>
      </xs:simpleType>

      When the instance document [1] is validated by the simpleType [2] Xerces would now display an error message like following:

      "The value must be divisible by 2. 101 is not divisible by 2."

      At run-time the placeholder (a kind of little macro) {$value} will be replaced by corresponding value from instance document. The placeholder for this purpose must have a name {$value}. There can be multiple instances of these placeholders in single assertions message, and all-of them will be replaced by the value from instance document.

      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: