<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<STYLE type="text/css"><!--
BODY {
margin: 5px 5px 5px 5px;
background-color: #FFFFFF;
}
/*----------Text Styles----------*/
HR { color: #000000}
BODY, TABLE /* Normal text */
{
font-size: 9pt;
font-family: 'Courier New';
font-style: normal;
font-weight: normal;
color: #000000;
text-decoration: none;
}
SPAN.RVTS1 /* Heading */
{
font-size: 10pt;
font-family: 'Arial';
font-weight: bold;
color: #0000FF;
}
SPAN.RVTS2 /* Subheading */
{
font-size: 10pt;
font-family: 'Arial';
font-weight: bold;
color: #000080;
}
SPAN.RVTS3 /* Keywords */
{
font-size: 10pt;
font-family: 'Arial';
font-style: italic;
color: #800000;
}
A.RVTS4, SPAN.RVTS4 /* Jump 1 */
{
font-size: 10pt;
font-family: 'Arial';
color: #008000;
text-decoration: underline;
}
A.RVTS5, SPAN.RVTS5 /* Jump 2 */
{
font-size: 10pt;
font-family: 'Arial';
color: #008000;
text-decoration: underline;
}
A.RVTS6, SPAN.RVTS6
{
color: #0000FF;
text-decoration: underline;
}
A.RVTS7, SPAN.RVTS7
{
color: #0000FF;
text-decoration: underline;
}
SPAN.RVTS8
{
font-weight: bold;
}
/*----------Para Styles----------*/
P,UL,OL /* Paragraph Style */
{
text-align: left;
text-indent: 0px;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
.RVPS1 /* Centered */
{
text-align: center;
white-space: normal;
}
--></STYLE>
</HEAD>
<BODY>
<P>Hello</P>
<P><BR></P>
<P>I'm just getting into the world Python/lxml.</P>
<P><BR></P>
<P>I did a little python module to valid an XML document against relaxNG rules with lxml.</P>
<P><BR></P>
<P>My purpose is to be abble to deliver a maximum of details when a validation error occur.</P>
<P><BR></P>
<P>I've found some informations here <A class=RVTS7 href="http://codespeak.net/lxml/dev/api.html#error-handling-on-exceptions">http://codespeak.net/lxml/dev/api.html#error-handling-on-exceptions</A></P>
<P><BR></P>
<P>Where Can I found the documentation API for <SPAN class=RVTS8>error_log</SPAN> ?</P>
<P><BR></P>
<P>I've found a bit by chance how to render the line number error but I would like for example to be abble to give to the users the offset (or position in line) where the error occur.</P>
<P><BR></P>
<P>Here is some part of my developpement code :</P>
<P><BR></P>
<P> def _result(self, docXml):</P>
<P> if self._relaxngEngine.validate(docXml):</P>
<P> resultValidation = "Document is valid"</P>
<P> else:</P>
<P> log = self._relaxngEngine.error_log[0]</P>
<P> #log = e.error_log.filter_levels(etree.ErrorLevels.FATAL)</P>
<P> #self._relaxngEngine.assertValid(docXml)</P>
<P> #resultValidation = log.last_error</P>
<P> resultValidation = log.domain_name, log.type_name, log.filename, log.line</P>
<P> </P>
<P> #resultValidation = self._relaxngEngine.error_log[0].col #(this doesn't work)</P>
<P><BR></P>
<P><BR></P>
<P>My main problem is that where is the complete documentation ?</P>
<P><BR></P>
<P>Thank you for help !!</P>
<P><BR></P>
<P><BR></P>
<P>Eric</P>
<P><BR></P>
<P>-----------------------------------</P>
<P>* Eric Garin - <A class=RVTS6 href="mailto:eric@detede.com">eric@detede.com</A> *</P>
<P>* DeTeDe - XML Editorial *</P>
<P>* C/ Aragó 410 Ent-6 *</P>
<P>* 08013 Barcelona *</P>
<P>* Tel. : (+34).93.246.27.67 *</P>
<P>* <A class=RVTS6 href="http://www.detede.com">www.detede.com</A> *</P>
<P>-----------------------------------</P>
</BODY></HTML>