Re: [xml] RelaxNG validation error reporting



On Mon, Nov 03, 2003 at 10:45:29AM +0100, Petr Pajas wrote:
Hi Daniel, All,

  Hi,

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

  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.

there a way to get full error information *without* rewriting the
existing application code to use the new structured error reporting

  That will be hard at this point. I had to revamp the error handling
code while maintaining minimal compatibility, and offer a more complete
API. The trade-off was to somewhat degrade the old processing, this was
the only way I could do this without getting into dangerous corner cases.

(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.

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 !

    thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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