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

Laurent Bihanic laurent.bihanic at atosorigin.com
Tue Jul 30 01:11:20 PDT 2002


Hi,

Which JDOM version are you using? If you are using the latest from CVS and if 
your document has some DocType information attached, you could try to prevent 
JDOM from reading and firing DTD events by disabling the SAX validation 
feature on JDOMSource:
    jds.getXMLReader().setFeature("http://xml.org/sax/features/validation", 
false);

Hope this helps,

Laurent


s s wrote:
> Hello All,
> 
> I am testing XSLT transformations using a JDOM Document. There are two 
> tests I am comparing: (Assuming we have a JDOM Document named 'document'.
> 
> 1) Using org.jdom.transform.JDOMSource as recommended by JDOM people:
> 
> JDOMSource jds = new JDOMSource(document);
> StreamResult jres = new StreamResult(stringWriter);
> transformer.transform(jds, jres);
> 
> 2) Using org.jdom.output.DOMOutputter and javax.xml.transformDOMSource:
> 
> DOMOutputter domo = new DOMOutputter();
> org.w3c.dom.Document documentW3C = domo.output(document);
> DOMSource ds = new DOMSource(documentW3C);
> StreamResult res = new StreamResult(stringWriter);
> transformer.transform(ds, res);
> 
> For a very large JDOM Document the following are the results I am getting:
> 
> Test 1) average: 12 seconds (for entire transformation)
> Test 2) average: 2 seconds (mostly for converting the document)
> 
> Can anybody explain why the difference in results? I don't even 
> understand the the 2 seconds result, when using the MS Parser+XSLT 
> processer it takes less than 1 second.
> 
> 
> Any help for speeding up my transformation would be very helpful. 
> Otherwise I might have to change my application to use 
> org.w3c.dom.Document all over which I don't want to since JDOM is much 
> nicer to use.
> 
> 
> Thanks!
> -- 
> Sean S.
> ss_theone at hotmail.com





More information about the jdom-interest mailing list