RE: [xml] Trying to use SAX

Thanks. I have already started trying the xmlReader and it looks like it
will do what I need.

Jack Allen

-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com] 
Sent: Tuesday, January 10, 2006 5:55 PM
To: Allen, Jack
Cc: 'xml gnome org'
Subject: Re: [xml] Trying to use SAX

On Tue, Jan 10, 2006 at 05:40:37PM -0500, Allen, Jack wrote:
  try to avoid it ! Use the xmlReader if you have a choice.
I choose the SAX API because from what I read it would use less memory
all and possibly be a little faster for my needs. The other APIs seem to
have to read the complete XML data and build a tree, then you have to
the tree for the keywords you want to use. Where as the SAX API allowed
building the information from the keywords as the XML data is being

  The XML reader is also  a streaming API, simpler to work with

I have setup the xmlSAXHandler
to callback my functions. The startDocument one works fine. But before
it calls my startElement function it takes a memory access error.
Running my program with gdb the backtrace looks like:

  is that a sax V2 handler ? 
No it was not and that was the problem. I had to look in the parser.h file
to see that the xmlSAXHandler had more elements in it for SAX 2. The
I was using as a guide must have been for SAX 1. After changing my
and assigning them to the correct element in xmlSAXHandler things are
working as I thought they should.
  Probably an error building the SAX handler or in the callbacks. Use the
xmlReader or the existing testSAX.c code as a guidance. Remember we can't 
debug your code.
Where can I find the testSAX.c code on the web? Like I said I am using
came with RedHat AS 4. So I am sure it is not the latest version of

  testSAX.c is part of the source release, you can find it in the
tar.gz or by installing the source RPM for libxml2 coming from RHEL.


Daniel Veillard      | Red Hat
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]