OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Customizing error messages

[ Lists Home | Date Index | Thread Index ]

This is one of the big problems with conventional schema languages.
The open source implementations, such as Xerces, allow you to customize the
error messages.

But customized error messages are not good enough for laymen. 

I think there are three possible approaches:

1) Build your own error-reporting layer on top. This involves seeing 
what their errors actually mean, and figuring out the clearest way
to present the errors to the user. Unfortunately, this is quite fragile,
because the next version of the validator may differ.  W3C XML Schemas
helps though, because it exhaustively lists all the possible error outcomes:
hence the cvc-complex-type.2.4.a  which can be figured out from 
the WXS specifications.

2) Use the parser's configuration options and filter the output so that
so that the user gets the most important error messages first.
This allows "progressive validation" rather than merely validating in
the order that problem crop up in the document. Unfortunately, this 
requires building your own code quite a lot.

3) Use Schematron. This very problem was one of the reasons for Schematron:
how to make user diagnostics that can be specified with the schema's
constraints, to allow more human and more customizable messages. 
In Schematron, you state the constraint (with XPaths) and then you
also provide a natural language statement of the constraint (the "assertion"),
and you can also specify a diagnostic string for that constraint: this string
can pull in values from the instance document to get very customized error
messages such as
    "The first element of X is supposed to be Y, but you provided a Z which
   is now deprecated. You can find more information in Manual 15 at page
  36."


Putting my money where my mouth is, in my company's editor product, we
customize the error messages, + allow sorting of errors, + allow selection
of the kinds of errors sought, + allow Schematron.  But Schematron is
the only really satisfactory technology for this kind of thing. There is a
free schematron validator (also, DTD, RELAX NG and WXS) available 
for Windows systems at 
  http://www.topologi.com/

Cheers
Rick Jelliffe
Topologi Pty. Ltd.

----- Original Message ----- 
From: "Jaywanth" <jrao@fsl.org.jm>
To: <xml-dev@lists.xml.org>
Sent: Friday, May 30, 2003 2:57 AM
Subject: [xml-dev] Customizing error messages


> Hi All,
> 
> I get very complex messages thrown at me when i validate my XML file against
> a schema using a validating parser . Is there is way to customize these
> messages ?? I need to show these errors to the user in a manner he can
> understand..
> 
> Sample error message thrown by the parser
> ----------------------------------------------
> [Error: (20:11) cvc-complex-type.2.4.a: Invalid content starting with
> element 'stratano'. The content must match
> '(((((((((("":valuationno),("":stratano)),("":propertyaddress)),("":fiscalye
> ar)),("":owner1)),("":owner2)),("":paidby)),("":tax)),("":penalty)),("":inte
> rest))'. ]
> 
> 
> 
> something like this would be helpful...
> --------------------------------------
> <error>
> <type>Formatting error </type>
> <line>20</line>
> <column>11</column>
> <message>Element 'stratano' expected after element 'valuationno'</message>
> </error>
> 
> 
> 
> 
> Thanks in advance
> Jaywanth
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 
>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS