[jdom-interest] Outputting documents to Xalan

Galluzzo, Eric EGalluzzo at synchrony.net
Wed Dec 13 06:04:34 PST 2000


> New to JDOM and XML in general, I having been using JDOM to 
> generate XML
> documents to process with Xalan.

[snip]

> Piped I/O ? :( There must be an easier way.
> 
> Luckily there is. (Well it worked for me!)
> 
> Xalan's XSLTInputSource takes as an argument a org.w3c.dom.Node which
> can be generated using a DOMOutputter 

[snip]

The advantage of using piped I/O is that (at least in theory) Xalan can
start processing the XML file as it's being built, whereas with DOM, the
entire tree has to be built before Xalan can start.  Outputting XML is also
sometimes quicker and certainly less memory-intensive than building a DOM
tree.  Of course, these are only important considerations if you're dealing
with pretty big XML files that will take a significant amount of time to
generate and/or memory to store as a DOM tree, or if you're working in a low
memory environment (which is unlikely if you're using Xalan).

On the other hand, if you output XML to a piped output stream, then Xalan
has got to parse the XML all over again, whereas the DOM tree is pre-parsed.
And if Xalan just makes a DOM tree out of the document before doing anything
useful (which I believe it does), then outputting a DOM tree from JDOM will
probably be faster regardless.  If you use an incremental XSLT processor
like they're trying to put into Mozilla (one of these days!), then that
would make piped I/O a better choice.

Hope that made sense, and feel free to correct me if I made any flagrant
mistakes (which knowing me I probably did :) ).

    - Eric



More information about the jdom-interest mailing list