I have the following code:
{
File outputFile = new File("out.xml");
Result outputResult = new StreamResult(outputFile);
File inputFile = new File("in.xml");
Result inputSource = new StreamSource(inputFile);
Transformer transformer = javax.xml.transform.TransformerFactory
.newInstance().newTransformer("stylesheet.xsl");
transformer.transform(inputSource, outputResult);
}
The default transformer instance is:
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
After this code runs, I cannot delete the created "out.xml" file while
JVM is running. If I use FileOutputStream instead of File, and close the
stream myself, then I can delete the file.
It seems to me that the Java-1.5 default Transformer opens a stream and
does not close it.
Anyone knows if there is a different reason?
If no, do you know a non-default Transformer that closes the stream
(rather than creating a stream myself).
Thanks, Ziv.