Re: How to merge 2 XML streams together?
Date: 22 Aug 2001 21:52:24 GMT
Message-ID: <998516929.451169_at_proxy.storm.co.za>
If you're applying an XSL to each, you're generating DocumentFragment objects (assuming the DOM model). I'm not an expert by any means, but I believe this means that you have to create a new XMLDocument with a dummy "root" element and then append the pieces to that new root element. I suspect you'll have to strip out your outermost tag from each (using your XSL), but keep the ROW tag. You should then be able to .appendChild both fragments to your new XMLDocument. Something like:
DocumentFragment result1 = processor.processXSL(xsl1, xml1);
DocumentFragment result2 = processor.processXSL(xsl2, xml2);
out = new XMLDocument;
Element root = out.createElement("root"); //new outermost tag?
out.appendChild(root);
root.appendChild(result1);
root.appendChild(result2);
I hope this helps.
Byron Lee
Terri I. wrote:
> I need to generate an XML stream to send to another server. The
> output will consist of a number of rows from 2 different
> tables. Depending on the table the row came from, the XML needs to be
> formatted somewhat differently. However, I need to
> send all of the output as 1 continuous XML stream, with all of the
> output from table 1 together followed by the output from the
> second table. I am trying to use Oracle's XSQL servlet to generate
> the XML and then use an XSL file to format appropriately.
> Is there a way for me to 'merge' XML streams together in 1 XML
> stream??
> (for example,
> <request type = "1">
> <query>select * from table1</query>
> <querydate>08/20/2001</querydate>
> <id>1</id>
> <id>1a</id>
> </request>
> <request type = "2">
> <query>select * from table2</query>
> <library>lib2</library>
> <id>2</id>
> <id>2a</id>
> </request>
Posted via www.orafocus.com - Focusing on the World of Oracle Received on Wed Aug 22 2001 - 23:52:24 CEST
