Re: [xml] Question about handling parser error messages

On Tue, Apr 17, 2007 at 10:58:36AM +0200, bagnacauda wrote:

I need your help with what certainly is a simple problem.
Following the example in testSchemas.c, I have set up
xmlSchemaSetParserErrors to redirect parser errors to handle errors then
I do an xmlSchemaParse. In case the schema has errors, the error handler
correctly get the message "Failed to parse the XML resource xxx" but I'm
also getting an error message on the stderr (/projects/batch/xsd/test.xsd:1:
parser error : Start tag expected, '<' not found) which is not being trapped
by my the error handler. What I am doing wrong? Is there something else I
should set up in addition to  xmlSchemaSetParserErrors?

  Start tag expected, '<' not found
is a parser error, not a validation error. So your callback on validation
error does not catch it.
What you need to do really depends on the kind of use, there are various
ways to catch errors in libxml2 which may or may not be suitable.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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