Project

General

Profile

Bug #3970

XSLT unnecessarily writes to a file

Added by Chris Weed over 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
actors
Target version:
Start date:
04/10/2009
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
3970

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);
}

History

#1 Updated by Matt Jones over 10 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?

#2 Updated by Chris Weed over 10 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.

#3 Updated by Daniel Crawl about 10 years ago

XSLTActor no longer writes the output to a temporary file.

#4 Updated by Redmine Admin over 6 years ago

Original Bugzilla ID was 3970

Also available in: Atom PDF