I am doing some bench marks on transformations using JAXP 1.1. One of the scenarios I am testing involves the use of a custom cache for the single xml file that I am going to transform. The cache parses the xml file the first time and then stores it in the Document (DOM) format within the cache for use thereafter (eliminating the need to parse that xml file every time). Here is the code snippet that I am using to perform the transformation: xform.transform(source, result); where 'source' is a DOMSource object and 'result' is a StreamResult. After retrieving the Document (DOM) from the cache I construct a DOMSource from this Document. If I use the following code:
xmlDomSource = new DOMSource(xmlDoc); where 'xmlDoc' is the Document (DOM) from my cache everything works fine and I see the transformed xml as HTML - all is good. However, if I construct my DOMSource the following way: xmlDomSource = new DOMSource(xmlDoc.getDocumentElement()); (again, where 'xmlDoc' is the Document (DOM) from the cache) the result of the transform simply yields the contents of the xml file with no tags. Essentially it has not been properly transformed - it just spits out the values found within the xml file. Any thoughts on why this might be happening? I am using the default JAXP 1.1 implementation (Crimson, Xalan). Any help or insights would be greatly appreciated. Thanks.