Looking at the source, it seems that I have to serialise my xml document so that libxml can parse it again, is that right, seems like a bit of a waste of time, though I guess for some situations at least (xinclude) if xmlSetExternalEntityLoader could accept an xmlDoc, the xmlDoc would have to be copied so maybe it is not that much more overhead.|
On 01/08/2007, at 03:06 , Rush Manbert wrote:
I have a lot of XML documents that are generated using the tree API or the XSLT API and I want to be able to refer to them in other XML document within LIBXML2 through URL's (xincludes, xslt imports, includes, document(), etc.). Looking at the documentation xmlSetExternalEntityLoader is what I want but I am not sure what I am supposed to do next. I guess I am supposed to create a xmlParserInputPtr but how do I create one for an XML document, is that what xmlNewEntityInputStream is for, in which case how do I create a xmlEntity.
The xsltproc utility does this, so get its source and see what it does. I actually hacked its init code to use in my app, and hacked the entity loader to call my own code.