[lxml] How to report validation errors in user friendly way

Piotr Oh piotrlg at gmail.com
Wed Apr 11 04:58:24 CDT 2012


Hi
Using schema.validate(tree) shows errors in english. To my users it is not
very friendly way of problem reporting.

What is the clever way to talk to user in his native language from
validation routines?

Or maybe I ask in other way: how to parse xml file after its validation,
where validator told me where the errors are and I'd like to say to the
user that the person xx has bad yy child (for example date).
Assuming such xml structure:
<persons>
 <person>
   <name>John</name>
   <date>2012-03-</date> - error
 </person>
 ....
</persons>

For me just printing the schema.error_log is ok, but not for the end user.
Now I'm using validate() method but maybe assertValid() is the way to go?

I'm not a programmer, the task I have done so far is take csv file
translate it to xml file, write it and then validate it. And it is working
fine. But doing user friendly program is tough task. So some guidelines are
welcome.

Thanx and regards
Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman-mail5.webfaction.com/pipermail/lxml/attachments/20120411/ec734c42/attachment.html 


More information about the lxml mailing list