[xml] Trying to use SAX

Title: Trying to use SAX

        I am trying to use the SAX API. 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:

Starting program: /home/jca/xml/event event.xml
[Thread debugging using libthread_db enabled]
[New Thread -1208018720 (LWP 10730)]

Entered document_start

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208018720 (LWP 10730)]
0x0042add6 in xmlSAX2StartElementNs () from /usr/lib/libxml2.so.2

(gdb) backtrace
#0  0x0042add6 in xmlSAX2StartElementNs () from /usr/lib/libxml2.so.2
#1  0x0041cad8 in xmlSkipBlankChars () from /usr/lib/libxml2.so.2
#2  0x00420f33 in xmlParseElement () from /usr/lib/libxml2.so.2
#3  0x003839ae in xmlParseDocument () from /usr/lib/libxml2.so.2
#4  0x00397ff6 in xmlSAXUserParseFile () from /usr/lib/libxml2.so.2
#5  0x080486b3 in parse_xml_file (arg_file=0xbff6ac42 "event.xml")
    at event.c:60
#6  0x080485eb in main (agc=2, arg=0xbfed5154) at event.c:37

The event.xml file contains:
<?xml version="1.0"?>
        <action>menu selection</action>

This is on RedHat AS 4, up2date.

Can someone give me some things to check as to why this is happening? If needed I can provide the source code to the program because it is small and really does not do anything but print which function it is in and some of the data. It will be part of a new project I am working on that will require parsing XML data.

Jack Allen

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