Re: [xml] Trying to use SAX



On Mon, Jan 09, 2006 at 08:53:20PM -0500, Allen, Jack wrote:
Hello: 
        I am trying to use the SAX API.

  try to avoid it ! Use the xmlReader if you have a choice.

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 ? 

Starting program: /home/jca/xml/event event.xml 

  Works fine here:

paphio:~/XML -> cat tst.xml
<?xml version="1.0"?>
<event>
        <number>1</number>
        <date>01-01-2006</date>
        <time>18:01:02</time>
        <action>menu selection</action>
</event>

paphio:~/XML -> ./testSAX --sax2 tst.xml
SAX.setDocumentLocator()
SAX.startDocument()
SAX.startElementNs(event, NULL, NULL, 0, 0, 0)
SAX.characters(
        , 9)
SAX.startElementNs(number, NULL, NULL, 0, 0, 0)
SAX.characters(1, 1)
SAX.endElementNs(number, NULL, NULL)
SAX.characters(
        , 9)
SAX.startElementNs(date, NULL, NULL, 0, 0, 0)
SAX.characters(01-01-2006, 10)
SAX.endElementNs(date, NULL, NULL)
SAX.characters(
        , 9)
SAX.startElementNs(time, NULL, NULL, 0, 0, 0)
SAX.characters(18:01:02, 8)
SAX.endElementNs(time, NULL, NULL)
SAX.characters(
        , 9)
SAX.startElementNs(action, NULL, NULL, 0, 0, 0)
SAX.characters(menu selection, 14)
SAX.endElementNs(action, NULL, NULL)
SAX.characters(
, 1)
SAX.endElementNs(event, NULL, NULL)
SAX.endDocument()

  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.

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]