|
Thanks everyone for your help.
I have created a simple test java program and I've got a problem:
What I do: I create a transformer (passing a byte array) - once! I create a streamResult (passing a byte array) - once! I create a streamSource (passing a byte array) - lots! I perform a transformation of the streamSource to the streamResult - lots!
Any help would be MOST appreciated!
Cheers
Larry Ducie
import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*;
public static TransformerFactory transFact; public static Transformer trans; public static Source xsltSource; public static Result result; public static Source xmlSource;
/** * Create a transformer object. */ public static int createTransformer(byte[] passedTransformer) {
try { // create a xslt transformer source object... xsltSource = new StreamSource(new File(new String(passedTransformer)));
// create an instance of TransformerFactory... transFact = TransformerFactory.newInstance();
// create a transformer object... trans = transFact.newTransformer(xsltSource);
// catch exception anr return error code... } catch (Exception e) { return -1; }
// return completion code... return 0; }
/** * Create a streamResult object... */ public static int createResult(byte[] passedResult) {
try { // create a streamResult object... result = new StreamResult(new File(new String(passedResult)));
// catch exception and return error code... } catch (Exception e) { return -1; }
// return complete OK code... return 0;
}
/** * Create an XML streamSource object... */ public static int createSource(byte[] passedSource) {
try { // create an XML streamSource object... xmlSource = new StreamSource(new File(new String(passedSource)));
// catch exception and return error code... } catch (Exception e) { return -1; }
// return complete OK... return 0; }
/** * Perform the transformation... */ public static int transform() {
try { trans.transform(xmlSource, result);
// catch exception and return error code... } catch (Exception e) { return -1; }
// return complete OK... return 0; } } //end class
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.