xsl-list
[Top] [All Lists]

Re: transforming multiple xml sources into a single stream

2003-10-16 14:02:17
Pramodh Peddi wrote:
I am using Java1.4.1's API for Transformation. I have 2 different xml
streams (not files on disk) in memory and have to use transformation to
merge them into a single xml stream. Is this possible?

Yes.

I know there is way to merge 2 xml files into a single if the files are on
the disk, but I am wondering if we can do this when streams are in memory.

There are several methods. The most geeky one is of course to
write a custom URIResolver and use it with a custom URI scheme
in order to pull in an in-memory stream via document(). There is
sample code for this in the list archive, or have a look
at the Cocoon project (http://cocoon.apache.org).

Less innovative methods include building two DOMs and merge them
(memory intensive), merge via a SAX filter or merging the streams
directly, perhaps using a custom FilterStream subclass (may be
brittle).

J.Pietschmann



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list