From: Stephane Conversy (Stephane.Conversy@lri.fr)
Date: Wed Aug 25 1999 - 13:04:16 EDT
Daniel Veillard wrote:
> On Tue, Aug 24, 1999 at 03:47:25PM +0200, Stephane Conversy wrote:
> >
> > How to handle error while parsing an xml file ?
> >
> > Is there a way to register a callback with a line number and a message ?
>
> yep, change the warning and errors function in the SAX callback
> block and have them point to your own function. The parser context
> which is passed as first argument holds file and line informations
> look at the existing code in error.c:
>
> http://dev.w3.org/cgi-bin/cvsweb/XML/error.c?rev=1.17&content-type=text/x-cvsweb-markup
>
> Daniel
>
>
ok now how to do the same with the validating pass ?
here is a snipet of my code using the validating parser:
xmlDocPtr doc;
xmlDoValidityCheckingDefaultValue = 1;
xmlDefaultSAXHandler.error = error_cbk;
xmlDefaultSAXHandler.warning = warning_cbk;
msg_ptr = msgs;
msgs[0]=0;
doc = xmlParseFile(file);
if(!doc) {
return;
}
I saw in the lib sources something like:
ctxt->vctxt.error = xmlParserValidityError;
How to get the ctxt before the begining of the parse pass ?
Btw, I ask some questions that may be in a doc somewhere, but I didn't
find it. Am I blind or it doesn't exist ?
stef
-- Stéphane Conversy http://www-ihm.lri.fr/~conversy/ mailto:conversy@lri.fr---- Message from the list xml@rufus.w3.org Archived at : http://rufus.w3.org/veillard/XML/messages to unsubscribe: echo "unsubscribe xml" | mail majordomo@rufus.w3.org
This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:44 EDT