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/
[EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml