[xml] SAX and userData

Date view Thread view Subject view Author view

From: Kristian Hogsberg Kristensen (hogsberg@daimi.au.dk)
Date: Thu Jun 03 1999 - 21:05:28 EDT


Hi,

I've been reading through the sources for gnome-xml the last few days,
and I've got a couple of questions:

When using SAX shouldn't you be able to specify the userData that is
always passed as first argument to the handlers? As it is,
ctxt->userData is just cleared when the SAX interface is used, whereas
the default SAX handler uses this to get at the xmlParserCtxt. If you
were to do anything serious [ie. other than 'printf("startTag: %s\n",
...)'] _a_n_d threadsafe you would need this. It's a fairly
simple extension, something like

    xmlSAXParseMemory(xmlSAXHandlerPtr sax, void *userData,
                      char *buffer, int size, int recovery) {
        [...]
        if (sax != NULL) {
            ctxt->sax = sax;
            ctxt->userData = userData;
        }

and similar for the rest of xmlSAXParse*.
  
Another thing: since this is an XML parser for Gnome, how come it is
kept independent of glib? (I can see from the ChangeLog that snprintf
was preferred over g_snprintf). Surely glib would save some lines of
code and if GHash was used instead of xmlElementTable and others maybe
a speedup could be expected?

regards, Kristian

----
Message from the list xml@rufus.w3.org
Archived at : http://rufus.w3.org/veillard/XML/messages
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rufus.w3.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:38 EDT