Project

General

Profile

Actions

Bug #3970

closed

XSLT unnecessarily writes to a file

Added by Chris Weed over 15 years ago. Updated over 15 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);
}

Actions #1

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?

Actions #2

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.

Actions #3

Updated by Daniel Crawl over 15 years ago

XSLTActor no longer writes the output to a temporary file.

Actions #4

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 3970

Actions

Also available in: Atom PDF