Hello,
I use libxml2, libxslt, and libxml2-python. In some tasks I need to
redefine the default entity loader. My application runs in multithreaded
mode, and each thread must have a different loader . Also imported and
included stylesheets must be loaded with the same loader as their parent
stylesheet. To implement this, I did the following:
1) added new `loaderId' slot in libxml2::include/libxml/tree.h:_xmlDoc
structure;
2) added new `loaderId' slot in libxml2::include/libxml/parser.h:
_xmlParserCtxt;
3) modified function `xsltDocDefaultLoaderFunc' changing the type of the
fourth argument to `xsltStylesheetPtr ctxt' and added the following:
pctxt = xmlNewParserCtxt();
/* hacked */
if (ctxt) {
par = ctxt->parent;
loaderId = ctxt->doc->loaderId;
pctxt->loaderId = doc->loaderId = (xsltStylesheet *)ctxt->doc->loaderId;
}
to `xsltDocDefaultLoaderFunc' (and modified every call of this function to
pass the right argument);
4) added accessors for `loaderId' to the python wrappers in `parserCtxt'
and `xmlDoc' classes;