[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Customizing error messages


cvc complex type.2.4.a
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@f...>
To: <xml-dev@l...>
Sent: Friday, May 30, 2003 2:57 AM
Subject:  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>
> 
>

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.