[xml] RelaxNG validation error reporting



Hi Daniel, All,

I have two questions conserning RelaxNG validation error reporting,
but the same may also apply to DTD and XSD (I didn't check that).

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
there a way to get full error information *without* rewriting the
existing application code to use the new structured error reporting
(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).

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?

Thanks,

-- Petr



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