RE: Converting Document object (DOM) into inputsource for XSL process ing in XT

Subject: RE: Converting Document object (DOM) into inputsource for XSL process ing in XT
From: "Maxime Levesque" <maximel@xxxxxxxxxxxxxx>
Date: Thu, 26 Aug 1999 13:10:32 -0700

  My experiments with piping streams is that unless the size of your stream
 is too big for your memory, your the performance is better when shoving
 it in a byte array...  


> Have you looked at using the PipedInputStream and PipedOutputStream
> combination? To gain the advantage, you would need to have two Threads.
> The first thread would create a PipedOutputStream and write your 
> DOM document
> to the stream. The second thread would create a PipedInputStream, 
> using the
> previously created PipedOutputStream in the constructor.
> 
> The advantage is you avoid having to convert the whole DOM tree 
> to a byte array
> before sending it off to the the XSL processor. With the piped 
> streams, the XSL
> processor could start processing the XML before the DOM tree is fully
> converted.
> 
> What I don't know is if the overhead of spawning a new Thread is 
> worse than
> creating the byte arrary. As the file gets larger however, the 
> piped streams
> would have more of an advantage.
> 
> The code would look something like this.
> 
> PipedOutputStream pipeOut = new PipedOutputStream();
> DOMWriter dw = new DOMWriter(pipeOut, (XmlDocument)myDOMDocument);
> dw.start();
> PipedInputStream pipeIn = new PipedInputStream(pipeOut);
> InputSource inputSource = new InputSource(pipeIn);
> myXslProcessor.parse(inputSource);
> 
> public class DOMwriter extends Thread {
>    OutputStream mOut;
>    XmlDocument mDoc;
>    DOMwriter(OutputStream out, XmlDocument doc) {
>       mOut = out;
>       mDoc = doc;
>    }
>    public void run() {
>      mDoc.write(mOut);
>    }
> }
> 
> >
> > Beside this, I tried using DOM directly with XSL:P processor, but it
> > wasn't faster than XT solution, so I'm deducting that it take longer
> > to work with DOM that to parse again the XML document and then work
> > with it internal and lightweight representation, is it true ?
> >
> > Thank for any reply, I would really appreciate.
> >
> > Sebastien Sahuc
> > ssahuc@xxxxxxxxxxxxxx
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >-- End of excerpt from Sebastien Sahuc
> 
> Dan
> 
> -- 
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> <> Dan Machak                    <>  machak@xxxxxxxxxxxx  <>
> <> MS T27A-1                     <>  650-604-2388 (VOICE) <>
> <> NASA Ames Research Center     <>  650-604-3957 (FAX)   <>
> <> Moffett Field, CA 94035-1000  <>                       <>
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread