Bug #3970
closedXSLT unnecessarily writes to a file
0%
Description
Instead of creating a temporary file that may fail, write the XSLT output to a string buffer.
//XSLT.java
StringWriter sw = new StringWriter();
// Executes the Transformer
try {
transformer.transform(xml, new StreamResult(sw));
htmlStr = sw.toString();
} catch (Exception e) {
MessageHandler.error("Transform error", e);
}
Updated by Matt Jones over 15 years ago
Some XML documents are large enough that String representations can memory limited. By using temporary files properly, we can avoid these memory issues (assuming the XMl isn't loaded into memory somewhere else, of course). Would it be acceptable to simply fix the temporary files problem?
Updated by Chris Weed over 15 years ago
(In reply to comment #1)
Some XML documents are large enough that String representations can memory
limited. By using temporary files properly, we can avoid these memory issues
(assuming the XMl isn't loaded into memory somewhere else, of course). Would it
be acceptable to simply fix the temporary files problem?
I would agree with you if the output of the class was a file name string pointing to where the output is stored, but you are returning the string itself. You have to allocate that memory anyway to return it.
Updated by Daniel Crawl over 15 years ago
XSLTActor no longer writes the output to a temporary file.