Re: [xml] request



On Wed, Nov 28, 2001 at 09:48:26AM +0100, robert wrote:
Daniel,

With xmlRegisterInputCallbacks() in xmlIO.c, it's possible to overload
the file-I/O routines. I use this function to implement my own I/O stuff,
because of the environment I run libxml in (multi-threaded, and files are
mostly only accessibly through special routines).

  Okay, sounds perfect.

However, it doesn't seem to be possible to remove the default callbacks,
also in xmlIO.c, altogether: when I call xmlCleanupInputCallbacks(),
the xmlInputCallbackInitialized variable is set to false, and at
some points the value of this variable is checked. If false, the
default callbacks are put in place again (this happens, for example, in
xmlParserInputBufferCreateFilename and xmlParserInputBufferCreateFile).

  Hum, actually the xmlCleanupInputCallbacks() and 
xmlCleanupOutputCallbacks() functions were designed specifically for the
use you suggest, they are not called by libxml itself it a purely user
convenience function.
  The fact that it resets xmlInputCallbackInitialized is actually a bug
since it breaks the expected use of the function. As the doc says it
should clear the table not make it invalid.

How do you think about creating a new function which can be used to set
the xmlInputCallbackInitialized-variable? Because the variable is static
(which is a good thing), I cannot tamper with it from within my own code. A
function which can be used to set it would be of great help to me.

  The right thing is to remove 
   xmlInputCallbackInitialized = 0;
and
   xmlOutputCallbackInitialized = 0;

from those two functions. I tested and commited this,

  thanks again, seems not that people used that code before :-\

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]