Re: assertion failures - providing feedback

Hi Noah,

On 15/02/2008, noah_mendelsohn@us.ibm.com <noah_mendelsohn@us.ibm.com> wrote:
> 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.

I think assertions are different because an assert either passes or
fails - there is no clue as to why it failed - the other at least
mention content model or type etc.


> 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.

In this particular case I just want to give someone an XSD and say
"make sure the XML you provide validates against that"... When
something fails validation it would be useful to present them with a
business rule in plain English rather than the XPath.

> 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.

How about an optional repeatable element:

<xs:assert test="...">
  <xs:msg lang="en UK">If a = 1 then b must also be 1</xs:msg>
  <xs:msg lang="de DE">Guten tag!</xs:msg>

The distinction being xs:annotation is aimed at the schema maintainer,
the assert failure message is for the schema user.

Just some thoughts.

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Received on Monday, 18 February 2008 11:57:23 UTC