Re: [xml] SAX and userData

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Fri Jun 04 1999 - 05:42:05 EDT


  Hi Kristian,

> 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*.

  Yes of course you're right. The point is that modifying the interfaces
would break binary compatibility. I'm in the phase of designing new, more
generic, parser interfaces, and then userData will be added.
  I agree that currently it makes using SAX nearly impossible. On the
other hand, I hope to have cleared all other place in the code which
were breaking reentrancy.

> 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?

  Well, the XML library is used outside of Gnome too. I really want to keep
libxml compilable without Gnome or even glib installed. Now, reusing glib
when it's available would make sense though, but I'm afraid that maintaining
detection code and the dual interfaces would be a pain, and maybe the gain
is not worth it.

   Daniel

-- 
	    [Yes, I have moved back to France !]
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux, WWW, rpmfind,
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | rpm2html, XML,
http://www.w3.org/People/W3Cpeople.html#Veillard | badminton, and Kaffe.
----
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