ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
Re: [xml-dev] Customizing error messages
by Rick Jelliffe other posts by this author
May 30 2003 6:19AM messages near this date
Re: [xml-dev] Vocabulary Combination and optional namespaces | Re: [xml-dev] Vocabulary Combination and optional namespaces
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@[...].jm> 
To: <xml-dev@[...].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>
>  
>  

-----------------------------------------------------------------
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> 
Thread:
Arjun Ray
Rick Jelliffe
james anderson
james anderson
K. Ari Krupnikov
Bob Foster
Arjun Ray
Thomas B. Passin
Thomas B. Passin
Bob Foster
Arjun Ray
K. Ari Krupnikov
Arjun Ray
K. Ari Krupnikov
Thomas B. Passin
Simon St.Laurent
Jonathan Borden
Thomas B. Passin
K. Ari Krupnikov
Arjun Ray
Simon St.Laurent
Chiusano Joseph
Arjun Ray
Chiusano Joseph
Chiusano Joseph
Arjun Ray
Thomas B. Passin
K. Ari Krupnikov
Arjun Ray
John Cowan
Arjun Ray
Bob Foster
W. E. Perry
Arjun Ray
Chiusano Joseph
Chiusano Joseph
Chiusano Joseph
W. E. Perry
Chiusano Joseph
Thomas B. Passin
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
K. Ari Krupnikov
james anderson
Arjun Ray
james anderson
Arjun Ray
Rick Jelliffe
james anderson
Arjun Ray
Jonathan Borden
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Arjun Ray
W. E. Perry
Arjun Ray
Rick Jelliffe
james anderson
Arjun Ray
Rick Jelliffe
Arjun Ray
Rick Jelliffe
Arjun Ray
james anderson
Simon St.Laurent
james anderson
Rich Salz
Jaywanth
Seairth Jacobs
Joe Gregorio
Arjun Ray
Arjun Ray
John Cowan
Simon St.Laurent
Arjun Ray
Paul Prescod
Arjun Ray
Paul Prescod
Arjun Ray
Tim Bray
MURATA Makoto
Arjun Ray
J.Pietschmann
Arjun Ray
Jason Diamond
Tim Bray
Tim Bray
Simon St.Laurent
Joe Gregorio
Paul Prescod
W. E. Perry
james anderson
james anderson
james anderson
Jonathan Borden
Miles Sabin
Simon St.Laurent
Jonathan Borden
Simon St.Laurent
W. E. Perry
Jonathan Borden
Simon St.Laurent
Thomas B. Passin
Jonathan Borden
Miles Sabin
Simon St.Laurent
Simon St.Laurent
Simon St.Laurent
Simon St.Laurent
Simon St.Laurent
Jonathan Borden
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Jonathan Borden
Miles Sabin
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
james anderson
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Tim Bray
james anderson
John Cowan
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Arjun Ray
W. E. Perry
james anderson
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Joe Gregorio
Joe English
Paul Prescod
Joe English
Arjun Ray
=?ISO-8859-1?Q?Bill_de_h=D3ra?=
Simon St.Laurent
Arjun Ray
Joe English
Simon St.Laurent
Simon St.Laurent
Arjun Ray

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved