[xsl] Performance benefit in using DOMResult?

Subject: [xsl] Performance benefit in using DOMResult?
From: "Vishwajit Pantvaidya" <pantvaidya@xxxxxxxxxxx>
Date: Tue, 26 Apr 2005 20:20:15 -0700
In my code that calls transformer.transform (using xalan transformer) to do xslt transformation, I was using StreamSource and StreamResult till now. But now I have a requirement to do further checks on the output xml to see if it has some specific nodes and if yes, then create xml string from those nodes. Since DOM will allow me to access random nodes directly, I feel that I need a DOM tree of the output xml.

One option is to continue using StreamResult and parse the xml again using DOM/SAX. But here it seems like I would be unnecessarily reparsing the output xml. So instead, I am thinking of replacing StreamResult by DOMResult. I can then carry out the further checks on the output DOM tree. The expected benefit is:
1. avoiding reparsing of transformed output xml
2. hopefully leverage the result tree that the transformer creates internally i.e. no DOM tree creation from scratch


Can someone tell me if pt 2 is even a possibility?

Will using DOMResult still result in a conversion from the internal tree structure to the DOM tree? Is there anyway to avoid this? If none, I presume I will still be better off since I still avoid reparsing the output xml.

Thanks,

Vish.

Current Thread