Re: [xml] RelaxNG validation error reporting

Daniel Veillard <veillard redhat com> writes:

1) I was quite surprised, that setting xmlRelaxNGSetValidErrors error
handlers to fprintf versus setting it to my custom routine (which in
turn only wraps vsprintf or similar), produce different error
messages: with fprintf I get full information, including filename and
line numbers, while with any other custom routine I only get the
'body' of the error message (no filename, line no.). My question is,
is it intentional (seems so according the code in error.c), and is

  yes intentional, so there is only one callback per error which was
a highly requested change. This also mean I can't make a callback 
for the context, and then a callback for the error informations.
The application can then grab the informations from the context or
the structured error handler.

ok I see. 
(I'm doing some work on XML-LibXML perl binding and at this point, I
just want to fix things, not rework, preserving compatibility with
2.5.x versions as long as possible; some rearranging may come later).

  understood, sorry about that but that part seriously changed, and there is
no easy workaround.

Ok, I guess I'll try to switch to structured errors with libxml2.6.1.
It has some indisputable benefits too and if it has to be done, it'll
be done :-)

2) sometimes, libxml2 only reports, that the document didn't validate
without giving any specific reason (just returns 1 from
xmlRelaxNGSetValidErrors but doesn't raise any error via the error
handlers). In these cases, xmllint only says 'fails to validate'.  I
have no 'real-life' examples for this, but try for example

xmllint --noout --relaxng tutorA.rng demo.xml

(files from libxml2's test/relaxng/). I would expect something like
"expecting element got TEI.2". Is it a bug? If not, are there some
typical situations, for this to happen?

  Then it's a bug, please bugzilla it !

Done as


-- Petr

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