Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
2.10.0
-
None
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.