I propose the XML Schema 1.1 <assert> element support user-friendly diagnostic messages via the XPath trace() function
"Costello, Roger L." <[email protected]>
| Newsgroups | gmane.text.xml.schema.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Folks,
The <assert> element in here checks that the meeting start time is before its end time:
<xs:element name="meeting">
<xs:complexType>
<xs:sequence>
<xs:element name="start" type="xs:time" />
<xs:element name="end" type="xs:time" />
</xs:sequence>
<xs:assert test="if (xs:time(start) lt xs:time(end)) then
true()
else
trace(false(), 'Hey, the meeting ends before it begins!')" />
</xs:complexType>
</xs:element>
Notice that I am using the XPath trace() function. It the assertion fails, I would like the XML Schema validator to output this user-friendly diagnostic message:
Hey, the meeting ends before it begins!
I propose that the XPath trace() function be overloaded in an XSD context to generate user-friendly error messages.
/Roger