W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

Re: I propose the XML Schema 1.1 <assert> element support user-friendly diagnostic messages via the XPath trace() function

From: Andrew Welch <andrew.j.welch@gmail.com>
Date: Tue, 26 Apr 2011 12:23:12 +0100
Message-ID: <BANLkTinHXmpDKmVwxzXSm5+neSCXyfKcLg@mail.gmail.com>
To: "Costello, Roger L." <costello@mitre.org>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
>             <xs:assert test="if (xs:time(start) lt xs:time(end)) then
>                                                      true()
>                                                else
>                                                       trace(false(), 'Hey,
> the meeting ends before it begins!')" />
> 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:
> I propose that the XPath trace() function be overloaded in an XSD context to
> generate user-friendly error messages.

When I did a small test framework a while back I had any non true
value returned as the failure message, so you could do something like:

if (a > b) then true() else concat(a, ' is not greater than ', b)

If true() was returned the test passed, anything else would be a fail
and the value shown to the user.

Not much help here, but I just thought I'd mention it :)

Andrew Welch
Received on Tuesday, 26 April 2011 11:23:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:19 UTC