Hi
I have a reallly big problem
runing Xalan.
Basically it has to to due with
the memory that I currently uses.
Senario :
The xml file I'm running is
currently 100M
The xsl file(s)
I'm running is a master with imports and includes.
When running Xalan writes
out the following message
- XALAN failed with
exception
java.lang.OutOfMemoryError
<<no stack trace available>>
One way to solve this is of
cource to increase the java VM size.
But it hardly seems as
the right sollution
to increase the VM to 1G
Is there any way to force XALAN
to flush the result tree to a file incrementaly
instead of building the
intire tree in the memory and then flush it ????
Regards
Torben Nielsen
Pine Tree Systems
Denmark
___________________________________________________________________________________
My original code segment is
looking like this. using Xalan-j_2_0_D01
// Run the master
xsl
BufferedOutputStream
masterXSLResult = null;
try
{
masterXSLResult = new BufferedOutputStream(new FileOutputStream("result.xml"),
1024);
} catch
(FileNotFoundException e)
{
}
try
{
cat.debug("Master XALAN: xsl = " + xslMaster + " xml = " +
orgFileName);
TransformerFactory tFactory =
TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(new
File(xslMaster)));
// Adding stylesheet parameters if any
given.
int nParams =
XSParams.size();
for(int i = 0; i < nParams;
i+=2)
transformer.setParameter((String)XSParams.elementAt(i),
(String)XSParams.elementAt(i+1));
// Calling the
Transformer
transformer.transform(new StreamSource(new File(orgFileName)), new
StreamResult(masterXSLResult));
cat.debug("Transform(" + xslMaster + ", " + orgFileName + ") = " +
masterXSLResult.toString());
} catch (Throwable ex)
{
cat.error("XALAN failed with exception",
ex);
handler.exitWithFailure(ex, failedDirSet, backUpDirSet);
}
___________________________________________________________________________________
I tried
using the latest stable build too (Xalan-j_2_2_D6)
// Create a transform factory
instance.
TransformerFactory tfactory =
TransformerFactory.newInstance();
InputStream xslIS = new BufferedInputStream(new
FileInputStream(xslMaster));
StreamSource xslSource = new
StreamSource(xslIS);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
xslSource.setSystemId(xslMaster);
// Create a transformer for the
stylesheet.
Transformer transformer =
tfactory.newTransformer(xslSource);
InputStream xmlIS = new BufferedInputStream(new
FileInputStream(orgFileName));
StreamSource xmlSource = new
StreamSource(xmlIS);
// Note that if we don't do this, relative URLs can not be resolved
correctly!
xmlSource.setSystemId(orgFileName);
// Transform the source XML to
System.out.
transformer.transform( xmlSource, new
StreamResult(System.out));
} catch (Throwable ex)
{
cat.error("XALAN failed with exception",
ex);
handler.exitWithFailure(ex, failedDirSet, backUpDirSet);
}