Re: [xml] sax + startElement
- From: Daniel Veillard <veillard redhat com>
- To: Jovan Kostovski <chombium gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] sax + startElement
- Date: Thu, 8 Feb 2007 14:00:00 -0500
On Thu, Feb 08, 2007 at 07:41:42PM +0100, Jovan Kostovski wrote:
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]);
}
}
}
Use SAX2 , make sure you didn't mix SAX1 and SAX2 . See testSAX.c
in the sources. If you can't debug this, use the xmlReader, really !
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
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]