[jdom-interest] Slower Transform using to use JDOMSource than DOMOutputter + DOMSource. Why??

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Jul 30 07:36:44 PDT 2002

At 2:26 PM +0000 7/30/02, s s wrote:
>hmmm... I am not sure if the problem is with DocType information 
>since I have none declared in my xml files.

I'm sorry. I misunderstood. When you said, "there is no DocType 
information attached to the document." I tough that was your problem.

>The problem as I had initially stated was that (by my tests) it was 
>faster to convert a JDOM document to DOM and then using DOMSource to 
>transform (Xalan-J2 XSLT processor) it into HTML. Rather than just 
>feeding the JDOM document through with JDOMSource into the 
>Does this mean I should change my code to use DOM instead of JDOM to 
>gain speed performance in the transformation? But that's a pain!

JDOM's source and result implementations sit on top of SAX. SAX is a 
streaming API. However, XSLT requires the building of a tree 
regardless, so we may not be getting the usual speed gain of SAX. 
Whichever underlying XSLT engine you're using is probably better 
optimized for DOM than for SAX. I wouldn't be surprised if other 
engines gave you different behavior.

What's really needed is an XSLT engine that can natively read JDOM. 
Unless somebody writes one, performance will be what it is, and 
probably pretty unpredictable.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |

More information about the jdom-interest mailing list