[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: Converting Document object (DOM) into inputsource for XSL pro cess ing in XT
From: Sebastien Sahuc <ssahuc@xxxxxxxxxxxxxx>
Date: Fri, 27 Aug 1999 10:59:01 +0200

Do you mean that for small document (less than 10Kb), it's faster to
transform DOM into byte[] and then reparse it  ? Did I understand
well?

Thank for your help .

Sebastien

> -----Original Message-----
> From: Maxime Levesque [mailto:	]
> Sent: jeudi 26 août 1999 22:11
> To: xsl-list@xxxxxxxxxxxxxxxx
> Subject: RE: Converting Document object (DOM) into inputsource for
XSL
> process ing in XT
> 
> 
> 
> 
>   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
> 


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



Current Thread
Keywords