Re: [xml] RelaxNG structured error reporting



Manuel González Castro <iinmgc00 ucv udc es> writes:

Hi,

Daniel Veillard wrote:
Does it mean that Relax NG module doesn't support the new
structured error system? Am I missing something? 

  Yes, there is room in the Relax-NG validation context for
registering such an handler but no API for this yet.

Ok. Now I'm triying to get Relax NG errors using the old API but I've faced a strange problem. If I use the 
same handlers as xmllint:

 xmlRelaxNGSetParserErrors(ctxt,
  (xmlRelaxNGValidityErrorFunc) fprintf,
  (xmlRelaxNGValidityWarningFunc) fprintf,
  stderr);

 xmlRelaxNGSetValidErrors(ctxt,
  (xmlRelaxNGValidityErrorFunc) fprintf,
  (xmlRelaxNGValidityWarningFunc) fprintf,
  stderr);

Maybe you have different fprintf from the one libxml2 was compiled
with? Or you are doing something wrong.
 
then I don't get filename or line number information. But xmllint does, and there's a message posted by 
Petr Pajas a few days ago (http://mail.gnome.org/archives/xml/2003-November/msg00018.html) saying that 
setting xmlRelaxNGSetValidErrors error handlers to fprintf reported full information. I've debugged 
"xmllint --noout --relaxng test.rng test.xml" but I can't find what makes the difference.


Check the following lines at the end of __xmlRaiseError in error.c:

void
__xmlRaiseError(xmlStructuredErrorFunc schannel,
... snip ...

        (channel == xmlParserValidityError) ||
        (channel == xmlParserValidityWarning))
        xmlReportError(to, ctxt, str, NULL, NULL);
    else if ((channel == (xmlGenericErrorFunc) fprintf) ||
             (channel == xmlGenericErrorDefaultFunc))
        xmlReportError(to, ctxt, str, channel, data);
    else
        channel(data, "%s", str);
}

-- Petr




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]