Re: [xml] Getting line number of schema validation errors
- From: "Eric Haszlakiewicz" <EHASZLA transunion com>
- To: <xml gnome org>
- Subject: Re: [xml] Getting line number of schema validation errors
- Date: Mon, 17 May 2004 10:56:31 -0500
Date: Sun, 16 May 2004 15:10:40 -0400
From: Daniel Veillard <veillard redhat com>
Subject: Re: [xml] Getting line number of schema validation errors
On Sun, May 16, 2004 at 10:58:30AM +0200, Israel Ganor wrote:
I validate XML files vs. a schema asfollows:
xmlSchemaSetValidErrors(validSchema,
(xmlSchemaValidityErrorFunc) ErrorCallback,
(xmlSchemaValidityWarningFunc) WarningCallback,
NULL);
xmlSchemaValidateDoc(validSchema, pDoc);
However, in ErrorCallback and WarningCallback I only get general
info about
the failure, but without the line number.
It it's very helpful to tell the user that there is an error in
<USER>
element, when his XML file contains 100 such elements.
Is there a way to tell the exact error line number?
Obviously not with that API. Use the xmlSetStructuredErrorFunc()
from xmlerror.h to register a global structure error handler, then
you should get the node where the error was generated.
Daniel
oh, of course. _obviously_ not. No one would ever think that a
schema
validation error callback would be handed the line number.
For those of us who don't know everything I submitted a bug to improve
the docs for the xmlSchemaSetValidErrors() function so it references
the
more useful xmlSetStructuredErrorFunc(). (#142760)
If there a function that will take the xmlError structure and format
a pretty error message? Does the message field in the xmlError
contain the file and line number, or is that just the basic error
info?
eric
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]