Re: [xml] Linx number available via SAX interface?

Date view Thread view Subject view Author view

From: Shane Adams (adamsch1@yahoo.com)
Date: Fri Jul 28 2000 - 10:55:48 EDT


I managed to figure it out after looking through the
library more. I create a FileParserCtxt, then set my
SAXHandler and set my 'user data'. The 'user data'
structure contains a pointer back to the
FileParserCtxt. When each SAX callback is invoked, I
receive my own datastructure that now contains a
pointer to the original context, and hence has the
line number, file name etc.

If anyone is interested, I can provide the code
example to explain more.

Thanks for the feedback.

Shane Adams

--- Daniel Veillard <Daniel.Veillard@w3.org> wrote:
>
> On Thu, Jul 27, 2000 at 05:26:26PM -0700, Shane
> Adams wrote:
> >
> > Hmmm I wonder if I'm doing something fundamentally
> > wrong. The passed in ctx pointer (void *) I use
> as my
> > "internal" data structure. Now in error.c, the
> > xmlParserError handler seems to cast it to a
> different
> > object. Should I really be doing something like
> this
> > in my callbacks? (Ignoring the line # problem for
> a
> > minute)
>
> The informations are extracted from the parser
> context (more precisely the pointer to the current
> entity
> being processed ctxt->input). If you use your own
> "internal" data structure then:
> 1/ you better know what you are doing
> 2/ you need to write your own error/warning
> handling routines
> Check xmlParserPrintFileInfo and xmlParserError
> for
> the standard code doing this. Those routines
> should
> replace the error/warning/fatalError in the SAX
> callback
> set.
> 3/ you should save the xmlParserCtxtPtr in use in
> the
> "internal" structure if you want to recover the
> extra
> line and context informations.
>
> Daniel
>
> --
> Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes |
> Today's Bookmarks :
> Tel : +33 476 615 257 | 655, avenue de l'Europe |
> Linux XML libxml WWW
> Fax : +33 476 615 207 | 38330 Montbonnot FRANCE |
> Gnome rpm2html rpmfind
> http://www.w3.org/People/all#veillard%40w3.org |
> RPM badminton Kaffe
> ----
> Message from the list xml@xmlsoft.org
> Archived at : http://xmlsoft.org/messages/
> to unsubscribe: echo "unsubscribe xml" | mail
majordomo@xmlsoft.org

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:24 EDT