Re: [xml] Re: xinclude question

Enno Rehling wrote:
Daniel Veillard wrote:

On Sat, Nov 22, 2003 at 02:43:45PM +0100, Enno Rehling wrote:

You will have to do it. By definition, the XInclude process is a recursive one, once you have generated the Infoset you're not supposed to be able to
go back to the initial structure, libxml2 is just nice in the sense that
it keeps markers to do this kind of things, but it's definitely not
a default processing, i.e. you will have to write that custom extension.

Okay, then the next question should obviously be: Is there a way I can hook into the xmlSave* routines to do this, or will I end up rewriting all those as well? I'm obviously looking for a way to do this where I end up replicating the least amount of already existing code.

It may be more palatable to do surgery on the dom.
I don't know the C API for this (I generally use the Perl binding), but
simply find each node that had ben xincluded, replace it with an appropriate
new xinclude node, converting the removed node into a document, and save each
document separately.

Alternatively, do you really need to carry out the xincludes in the first
place?  Ie. does your app require that they be expanded in place, or can
you simply process the document & subdocuments separately?

And of course, assuming you're not extracting some portion of the
included document via fragments or xpointers....


xml mailing list, project page
xml gnome org

bruce miller nist gov

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]