[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting Document object (DOM) into inputsource for XS

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
converting document to stream object

  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.