[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

SAX for XSL Transformation

Subject: SAX for XSL Transformation
From: "santhosh nair" <santhosh_as@xxxxxxxxxxx>
Date: Thu, 17 Feb 2005 10:29:26 -0800
sax xsl transform
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) {
        System.out.println(
           "Usage: XML-File Stylesheet Output-File");
        System.exit(5);
     }

     // 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) {
        System.out.println(ex);
        System.exit(16);
     }
  }

}

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

Thanks

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.