[xsl] SAX for XSL Transformation

Subject: [xsl] SAX for XSL Transformation
From: "santhosh nair" <santhosh_as@xxxxxxxxxxx>
Date: Thu, 17 Feb 2005 10:29:26 -0800
Hello All,

I just joined the group. I'm not exactly sure how to post is a specific topic.
I have a question regarding the use of SAX parser for XSL transformation. I'm not very familliar with XML technologies. I'm trying to transform a 80M file using an XSL stylesheet to an output stream. I was able to do all this when the file was only about 40Meg.
Now I am having problems with out of memory errors from the JVM ,I'm assuming that the JAXP API uses a DOM object to do this transformation.

Here is the code (Which again I found on the internet)

Package com.ual.amis.frmfim;
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class Transform {

  public Transform() {

  public static void main(String[] args) {
     // If not enough args, print usage.
     if (args.length < 3) {
           "Usage: XML-File Stylesheet Output-File");

     // Get command-line args.
     File xmlFile = new File(args[0]);
     File xslFile = new File(args[1]);
     File outFile = new File(args[2]);

     // Create xsl source, input source, and result streams.
     StreamSource xslSource = new StreamSource(xslFile);
     StreamSource xmlSource = new StreamSource(xmlFile);
     StreamResult outResult = new StreamResult(outFile);

     try {
        // Get transformer factory and transformer.
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(xslSource);

        // Do transformation.
        transformer.transform(xmlSource, outResult);
     } catch(Exception ex) {


Is there a way to instruct the Transformer to use a SAX parser explicitly.


Current Thread