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 over
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 search
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
processed.

  The XML reader is also  a streaming API, simpler to work with
    http://xmlsoft.org/xmlreader.html

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 example
I was using as a guide must have been for SAX 1. After changing my functions
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 what
came with RedHat AS 4. So I am sure it is not the latest version of libxml2.
@@@@@@@@@@

  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

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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