Re: [xml] using xmlSetExternalEntityLoader to return internally generated XML documents
- From: Daniel Veillard <veillard redhat com>
- To: Nathan Day <nathan_day mac com>
- Cc: xml gnome org
- Subject: Re: [xml] using xmlSetExternalEntityLoader to return internally generated XML documents
- Date: Tue, 31 Jul 2007 07:52:55 -0400
On Tue, Jul 31, 2007 at 10:26:01AM +1000, Nathan Day 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.
Use the source ! Sorry, this is kind of a lame answer but it's the best
I can really provide without spending a lot of time. See
xmlDefaultExternalEntityLoader()
in xmlIO.c and how it uses xmlNewInputFromFile()
I have some XSL transformations that take a long time, up to 6 seconds
in some cases, fortunately large parts of
these transformations produce the same result. So what I want to do is
create a mechanism so that when a XML document is
being serialised into a string I can have my own call back function
called at particular points so that I can insert
previously serialised text. I suppose I could just insert a big text
element into the xml document another possibility is to serialise the
document my self, this is for generating HTML, would this be
difficult.
There is no mechanism for callback in the serializer, I don't see how
this could easilly be added. I also don't fully underdstand how this
relates to XSLT and transformation time. But for the serializer this
is synchronous. Also you can't just plug XML in the document as text and
expect that to work as you seems to think because all the <, > and &
in said text will be properly escaped to < > and & as expected
from a serializer. In a nutshell you can't mix semantic layers like this.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
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]