[xml] sax + startElement


I'm writing a sax parser in c. So far everything looked good
till I needed to extract the element values (attributes).

I want to extract the element atributes and to fill in some structures in
my program.

My startElement handler which I wrote for testing
is a copy of code from xmllinit.c

void startElement(void * ctx, const xmlChar * name, const xmlChar ** atts) {
        int i;

fprintf(stdout, "SAX.startElement(%s", (char *) name);
   if (atts != NULL) {
       for (i = 0;(atts[i] != NULL);i++) {
            fprintf(stdout, ", %s='", atts[i++]);
            if (atts[i] != NULL)
                fprintf(stdout, "%s'", atts[i]);

The problem is that I always get NULL pointer for atts structure. Any Ideas?

I'm testing the parser with small xml file:

<?xml version="1.0"?>

BR, Jovan

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