[xml] sax + startElement
- From: "Jovan Kostovski" <chombium gmail com>
- To: xml gnome org
- Subject: [xml] sax + startElement
- Date: Thu, 8 Feb 2007 19:41:42 +0100
Hi,
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"?>
<array>
<number>0</number>
<number>1</number>
<number>42</number>
</array>
BR, Jovan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]