Subject: RE: Converting Document object (DOM) into inputsource for XSL process ing in XT From: "Maxime Levesque" <maximel@xxxxxxxxxxxxxx> Date: Fri, 27 Aug 1999 10:20:20 -0700 |
The better approach is to use John Cowan's DOMParser (http://www.ccil.org/~cowan/XML/) (* thanks for the link Michael) InputSource domSource = new org.ccil.cowan.sax.DOMSource(yourDocument); Parser inputParser = new org.ccil.cowan.sax.DOMParser(); Parser sheetParser = "... your favorite XML parser ..."; XSLProcessorImpl xt = new XSLProcessorImpl(); xt.setParser(inputParser, sheetParser); xt.parse(domSource); This will avoid the unnecessary 'flattening' and parsing. > 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? Flattening the DOM tree onto byte[]s and reparsing it will always be costly, what Dan was suggesting was to 'pipe' : (1) DOM -> DOMWriter -> InputStreamWriter -> PipedOutputStream -> PipedInputStream -> SAXParser instead of : (2) flattening : DOM -> DOMWriter -> InputStreamWriter -> byte[] and then inflating : byte[] -> ByteArrayInputStream -> SAXParser in two separate steps. (1) has the advantage of being memory efficient (the memory usage is the size of the PipedInputStream's buffer). The overhead of (1) is that there is a that the threads are 'waiting' and 'notifying' a lot, but for big enough documents (2) will bust your memory. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Converting Document object (DOM, Sebastien Sahuc | Thread | RE: Converting Document object (DOM, Kay Michael |
Re: xsl:for-each within an element?, Dan Machak | Date | RE: DOM object to input source for , Kay Michael |
Month |