[xml] question regarding error reporting

Hi Daniel, all,

I've got a question on the error/warning reporting mechanism.  I've got custom
error functions defined and are used to redirect errors/warnings to a log file.
Part of my application performs relax-ng validation, however any
errors/warnings generated by the relaxng portion aren't really "errors" so I
redirect them to different error handlers using xmlRelaxNGSetValidErrors()
which works fine.

The issue is by doing so I miss a lot of the information that is normally
printed out, such as source file, line, error domain, etc.  Going through the
code I notice at the tail in of __xmlRaiseError
  if ((channel == xmlParserError) ||
        (channel == xmlParserWarning) ||
        (channel == xmlParserValidityError) ||
        (channel == xmlParserValidityWarning))
        xmlReportError(to, ctxt, str, NULL, NULL);
    else if ((channel == (xmlGenericErrorFunc) fprintf) ||
             (channel == xmlGenericErrorDefaultFunc))
        xmlReportError(to, ctxt, str, channel, data);
        channel(data, "%s", str);

that xmlReportError which generates that extra info from the xmlLastError (to)
is only called if channel (in this case xmlRelaxNGValidCtxt.error) is fprintf

Is there a reason that xmlReportError isn't called regardless of what error
handler channel points to?


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