W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2008

Re: assertion failures - providing feedback

From: <noah_mendelsohn@us.ibm.com>
Date: Fri, 15 Feb 2008 14:27:50 -0500
To: "Pete Cordell" <petexmldev@codalogic.com>
Cc: "Andrew Welch" <andrew.j.welch@gmail.com>, xmlschema-dev@w3.org
Message-ID: <OF3D8F486E.D3CBD024-ON852573F0.006A8F56-852573F0.006AD674@lotus.com>

I think the point is that XML Schema has a uniform way of reflecting 
validation results, and the proposed xs:assertion mechanism uses that in a 
consistent manner.  Note that in many cases XSD validators are embedded in 
other programs.  Sometimes having a textual error message as in schematron 
is helpful, but often programs prefer programmatic interfaces.   While XSD 
does not mandate any particular API for such purposes, it is intended to 
support use through APIs.  Another complication with error messages is the 
potential requirement in some situations to allow messages to be provided 
in multiple languages, such as English, French and Chinese.  As has been 
noted, use of <xs:annotation> on assertions is a potential building block 
for hanging textual descriptions onto assertions, should you wish to.

Noah

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








"Pete Cordell" <petexmldev@codalogic.com>
Sent by: xmlschema-dev-request@w3.org
02/14/2008 01:21 PM
 
        To:     "Andrew Welch" <andrew.j.welch@gmail.com>, 
<xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Re: assertion failures - providing feedback



An xs:assert does seem to allow an xs:annotation.  Does that help?  I 
guess 
it might help the developer, but you'd have to make assumptions about the 
contents of the text before you displayed it to a regular user.

And if you're going to display messages embedded in the XML schema to a 
user, what's the effect of internationalisation / localisation of such 
error 
messages?  Would the messages need to be parameterized in the general 
case?

Regards,

Pete Cordell
Codalogic
Visit http://www.codalogic.com/lmx/ for XML C++ data binding

----- Original Message ----- 
From: "Andrew Welch" <andrew.j.welch@gmail.com>
To: <xmlschema-dev@w3.org>
Sent: Thursday, February 14, 2008 4:46 PM
Subject: assertion failures - providing feedback


>
> What is the intended way to provide feedback when an assertion fails?
>
> Given:
>
> <xs:assert test="@min le @max"/>
>
> How would you say "The min attribute must be less than or equal to the
> max attribute" when the test fails?
>
> I hope it's not:
>
> <xs:assert test="if (@min le @max) then true() else
> error('http://mycomp.com', 'myerr:minlessthanmax', 'The min attribute
> must be less than or equal to the max attribute')"/>
>
>
>
> thanks
> -- 
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/
>
> 
Received on Friday, 15 February 2008 19:27:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:02 GMT