You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ch...@apache.org on 2002/03/25 19:08:28 UTC

cvs commit: xml-fop/src/org/apache/fop/tools/xslt XSLTransform.java

chrisg      02/03/25 10:08:28

  Modified:    src/org/apache/fop/apps Tag: fop-0_20_2-maintain
                        AWTStarter.java CommandLineStarter.java Driver.java
                        InputHandler.java PrintStarter.java Starter.java
               src/org/apache/fop/configuration Tag: fop-0_20_2-maintain
                        ConfigurationReader.java
               src/org/apache/fop/fonts/apps Tag: fop-0_20_2-maintain
                        PFMReader.java TTFReader.java
               src/org/apache/fop/image Tag: fop-0_20_2-maintain
                        SVGImage.java
               src/org/apache/fop/tools/anttasks Tag: fop-0_20_2-maintain
                        Fop.java
               src/org/apache/fop/tools/xslt Tag: fop-0_20_2-maintain
                        XSLTransform.java
  Log:
  makes FOP running with any JAXP1.1 compliant parser
  Submitted by: Joerg Pietschmann <jo...@zkb.ch>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +1 -3      xml-fop/src/org/apache/fop/apps/AWTStarter.java
  
  Index: AWTStarter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/AWTStarter.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- AWTStarter.java	17 Sep 2001 13:29:52 -0000	1.9
  +++ AWTStarter.java	25 Mar 2002 18:08:27 -0000	1.9.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: AWTStarter.java,v 1.9 2001/09/17 13:29:52 keiron Exp $
  + * $Id: AWTStarter.java,v 1.9.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -105,8 +105,6 @@
           if (parser == null) {
               throw new FOPException("Unable to create SAX parser");
           }
  -
  -        setParserFeatures(parser);
   
           try {
               driver.setRenderer(renderer);
  
  
  
  1.11.2.2  +1 -2      xml-fop/src/org/apache/fop/apps/CommandLineStarter.java
  
  Index: CommandLineStarter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/CommandLineStarter.java,v
  retrieving revision 1.11.2.1
  retrieving revision 1.11.2.2
  diff -u -r1.11.2.1 -r1.11.2.2
  --- CommandLineStarter.java	17 Mar 2002 23:37:06 -0000	1.11.2.1
  +++ CommandLineStarter.java	25 Mar 2002 18:08:27 -0000	1.11.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: CommandLineStarter.java,v 1.11.2.1 2002/03/17 23:37:06 chrisg Exp $
  + * $Id: CommandLineStarter.java,v 1.11.2.2 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -51,7 +51,6 @@
           log.info(version);
   
           XMLReader parser = inputHandler.getParser();
  -        setParserFeatures(parser);
   
           Driver driver = new Driver();
           driver.setLogger(log);
  
  
  
  1.36.2.3  +6 -8      xml-fop/src/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.36.2.2
  retrieving revision 1.36.2.3
  diff -u -r1.36.2.2 -r1.36.2.3
  --- Driver.java	17 Mar 2002 23:37:06 -0000	1.36.2.2
  +++ Driver.java	25 Mar 2002 18:08:27 -0000	1.36.2.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Driver.java,v 1.36.2.2 2002/03/17 23:37:06 chrisg Exp $
  + * $Id: Driver.java,v 1.36.2.3 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -177,15 +177,13 @@
       private Logger log;
   
       public static final String getParserClassName() {
  -        String parserClassName = null;
           try {
  -            parserClassName = System.getProperty("org.xml.sax.parser");
  -        } catch (SecurityException se) {}
  -
  -        if (parserClassName == null) {
  -            parserClassName = "org.apache.xerces.parsers.SAXParser";
  +            return javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser().getXMLReader().getClass().getName();
  +        } catch (javax.xml.parsers.ParserConfigurationException e) {
  +            return null;
  +        } catch (org.xml.sax.SAXException e) {
  +            return null;
           }
  -        return parserClassName;
       }
   
       /**
  
  
  
  1.5.2.1   +12 -17    xml-fop/src/org/apache/fop/apps/InputHandler.java
  
  Index: InputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/InputHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- InputHandler.java	14 Aug 2001 08:50:47 -0000	1.5
  +++ InputHandler.java	25 Mar 2002 18:08:27 -0000	1.5.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: InputHandler.java,v 1.5 2001/08/14 08:50:47 keiron Exp $
  + * $Id: InputHandler.java,v 1.5.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -14,6 +14,7 @@
   // Java
   import java.net.URL;
   import java.io.File;
  +import javax.xml.parsers.*;
   
   // FOP
   import org.apache.fop.messaging.MessageHandler;
  @@ -53,27 +54,21 @@
       }
   
       /**
  -     * creates a SAX parser, using the value of org.xml.sax.parser
  -     * defaulting to org.apache.xerces.parsers.SAXParser
  +     * creates a SAX parser
        *
        * @return the created SAX parser
        */
       protected static XMLReader createParser() throws FOPException {
  -        String parserClassName = Driver.getParserClassName();
  -        MessageHandler.logln("using SAX parser " + parserClassName);
  -
           try {
  -            return (XMLReader)Class.forName(parserClassName).newInstance();
  -        } catch (ClassNotFoundException e) {
  -            throw new FOPException(e);
  -        } catch (InstantiationException e) {
  -            throw new FOPException("Could not instantiate "
  -                                   + parserClassName, e);
  -        } catch (IllegalAccessException e) {
  -            throw new FOPException("Could not access " + parserClassName, e);
  -        } catch (ClassCastException e) {
  -            throw new FOPException(parserClassName + " is not a SAX driver",
  -                                   e);
  +            SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
  +            spf.setNamespaceAware(true);
  +            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
  +            MessageHandler.logln("Using " + xmlReader.getClass().getName() + " as SAX2 Parser"); 
  +            return xmlReader;
  +        } catch (javax.xml.parsers.ParserConfigurationException e) {
  +          throw new FOPException(e);
  +        } catch (org.xml.sax.SAXException e) {
  +          throw new FOPException( e);
           }
       }
   
  
  
  
  1.7.2.1   +1 -3      xml-fop/src/org/apache/fop/apps/PrintStarter.java
  
  Index: PrintStarter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/PrintStarter.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- PrintStarter.java	1 Aug 2001 23:08:54 -0000	1.7
  +++ PrintStarter.java	25 Mar 2002 18:08:27 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PrintStarter.java,v 1.7 2001/08/01 23:08:54 gears Exp $
  + * $Id: PrintStarter.java,v 1.7.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -63,8 +63,6 @@
           MessageHandler.errorln(version);
   
           XMLReader parser = inputHandler.getParser();
  -
  -        setParserFeatures(parser);
   
           PrinterJob pj = PrinterJob.getPrinterJob();
           if(System.getProperty("dialog") != null)
  
  
  
  1.6.2.2   +1 -12     xml-fop/src/org/apache/fop/apps/Starter.java
  
  Index: Starter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Starter.java,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- Starter.java	17 Mar 2002 23:37:06 -0000	1.6.2.1
  +++ Starter.java	25 Mar 2002 18:08:27 -0000	1.6.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Starter.java,v 1.6.2.1 2002/03/17 23:37:06 chrisg Exp $
  + * $Id: Starter.java,v 1.6.2.2 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -42,16 +42,5 @@
       }
   
       abstract public void run() throws FOPException;
  -
  -    // setting the parser features
  -    public void setParserFeatures(XMLReader parser) throws FOPException {
  -        try {
  -            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
  -                              true);
  -        } catch (SAXException e) {
  -            throw new FOPException("Error in setting up parser feature namespace-prefixes\n"
  -                                   + "You need a parser which supports SAX version 2", e);
  -        }
  -    }
   
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +15 -29    xml-fop/src/org/apache/fop/configuration/ConfigurationReader.java
  
  Index: ConfigurationReader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/configuration/ConfigurationReader.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ConfigurationReader.java	30 Jul 2001 20:29:18 -0000	1.8
  +++ ConfigurationReader.java	25 Mar 2002 18:08:27 -0000	1.8.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ConfigurationReader.java,v 1.8 2001/07/30 20:29:18 tore Exp $
  + * $Id: ConfigurationReader.java,v 1.8.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -11,9 +11,12 @@
   import org.xml.sax.helpers.DefaultHandler;
   import org.xml.sax.XMLReader;
   import org.xml.sax.SAXException;
  -import java.io.IOException;
   import org.xml.sax.InputSource;
   
  +// java
  +import java.io.IOException;
  +import javax.xml.parsers.*;
  +
   // fop
   import org.apache.fop.apps.Driver;
   import org.apache.fop.messaging.MessageHandler;
  @@ -61,14 +64,6 @@
       public void start() throws FOPException {
           XMLReader parser = createParser();
   
  -        // setting the parser features
  -        try {
  -            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
  -                              false);
  -        } catch (SAXException e) {
  -            throw new FOPException("You need a parser which supports SAX version 2",
  -                                   e);
  -        }
           ConfigurationParser configurationParser = new ConfigurationParser();
           parser.setContentHandler(configurationParser);
   
  @@ -86,30 +81,21 @@
       }
   
       /**
  -     * creates a SAX parser, using the value of org.xml.sax.parser
  -     * defaulting to org.apache.xerces.parsers.SAXParser
  +     * creates a SAX parser
        *
        * @return the created SAX parser
        */
       public static XMLReader createParser() throws FOPException {
  -        String parserClassName = Driver.getParserClassName();
  -        if (errorDump) {
  -            MessageHandler.logln("configuration reader using SAX parser "
  -                                 + parserClassName);
  -        }
  -
           try {
  -            return (XMLReader)Class.forName(parserClassName).newInstance();
  -        } catch (ClassNotFoundException e) {
  -            throw new FOPException("Could not find " + parserClassName, e);
  -        } catch (InstantiationException e) {
  -            throw new FOPException("Could not instantiate "
  -                                   + parserClassName, e);
  -        } catch (IllegalAccessException e) {
  -            throw new FOPException("Could not access " + parserClassName, e);
  -        } catch (ClassCastException e) {
  -            throw new FOPException(parserClassName + " is not a SAX driver",
  -                                   e);
  +            SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();
  +            spf.setNamespaceAware(true);
  +            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
  +            MessageHandler.logln("Using " + xmlReader.getClass().getName() + " as SAX2 Parser"); 
  +            return xmlReader;
  +        } catch (javax.xml.parsers.ParserConfigurationException e) {
  +          throw new FOPException(e);
  +        } catch (org.xml.sax.SAXException e) {
  +          throw new FOPException( e);
           }
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +18 -8     xml-fop/src/org/apache/fop/fonts/apps/PFMReader.java
  
  Index: PFMReader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/apps/PFMReader.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- PFMReader.java	30 Jul 2001 20:29:26 -0000	1.7
  +++ PFMReader.java	25 Mar 2002 18:08:27 -0000	1.7.2.1
  @@ -1,17 +1,13 @@
   /*
  - * $Id: PFMReader.java,v 1.7 2001/07/30 20:29:26 tore Exp $
  + * $Id: PFMReader.java,v 1.7.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  -
   package org.apache.fop.fonts.apps;
   
   import java.io.*;
   import org.w3c.dom.*;
  -import org.apache.xerces.dom.*;
  -import org.apache.xml.serialize.*;
  -import org.apache.xalan.xslt.*;
   import org.apache.fop.fonts.*;
   import java.util.Hashtable;
   import java.util.Vector;
  @@ -197,13 +193,19 @@
           System.out.println();
   
           try {
  -            OutputFormat format = new OutputFormat(doc);    // Serialize DOM
  -            FileWriter out = new FileWriter(target);    // Writer will be a String
  +          javax.xml.transform.TransformerFactory.newInstance()
  +            .newTransformer().transform(
  +              new javax.xml.transform.dom.DOMSource(doc),
  +              new javax.xml.transform.stream.StreamResult(new File(target)));
  +/*
  +          OutputFormat format = new OutputFormat(doc);    // Serialize DOM
  +          FileWriter out = new FileWriter(target);    // Writer will be a String
               XMLSerializer serial = new XMLSerializer(out, format);
               serial.asDOMSerializer();                       // As a DOM Serializer
   
               serial.serialize(doc.getDocumentElement());
               out.close();
  +*/
           } catch (Exception e) {
               e.printStackTrace();
           }
  @@ -220,7 +222,15 @@
           System.out.println("Creating xml font file...");
           System.out.println();
   
  -        Document doc = new DocumentImpl();
  +//        Document doc = new DocumentImpl();
  +        Document doc;
  +        try {
  +          doc = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  +        }
  +        catch (javax.xml.parsers.ParserConfigurationException e) {
  +          System.out.println("Can't create DOM implementation "+e.getMessage());
  +          return null;
  +        }
           Element root = doc.createElement("font-metrics");
           doc.appendChild(root);
           root.setAttribute("type", "TYPE1");
  
  
  
  1.4.2.1   +17 -6     xml-fop/src/org/apache/fop/fonts/apps/TTFReader.java
  
  Index: TTFReader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fonts/apps/TTFReader.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- TTFReader.java	30 Jul 2001 20:29:26 -0000	1.4
  +++ TTFReader.java	25 Mar 2002 18:08:27 -0000	1.4.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: TTFReader.java,v 1.4 2001/07/30 20:29:26 tore Exp $
  + * $Id: TTFReader.java,v 1.4.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,9 +8,6 @@
   
   import java.io.*;
   import org.w3c.dom.*;
  -import org.apache.xerces.dom.*;
  -import org.apache.xml.serialize.*;
  -import org.apache.xalan.xslt.*;
   import org.apache.fop.fonts.*;
   import java.util.Hashtable;
   import java.util.Vector;
  @@ -198,13 +195,19 @@
           System.out.println();
   
           try {
  -            OutputFormat format = new OutputFormat(doc);    // Serialize DOM
  +          javax.xml.transform.TransformerFactory.newInstance()
  +            .newTransformer().transform(
  +              new javax.xml.transform.dom.DOMSource(doc),
  +              new javax.xml.transform.stream.StreamResult(new File(target)));
  +
  +/*            OutputFormat format = new OutputFormat(doc);    // Serialize DOM
               FileWriter out = new FileWriter(target);    // Writer will be a String
               XMLSerializer serial = new XMLSerializer(out, format);
               serial.asDOMSerializer();                       // As a DOM Serializer
   
               serial.serialize(doc.getDocumentElement());
               out.close();
  +*/
           } catch (Exception e) {
               e.printStackTrace();
           }
  @@ -222,7 +225,15 @@
           System.out.println("Creating xml font file...");
           System.out.println();
   
  -        Document doc = new DocumentImpl();
  +//        Document doc = new DocumentImpl();
  +        Document doc;
  +        try {
  +          doc = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  +        }
  +        catch (javax.xml.parsers.ParserConfigurationException e) {
  +          System.out.println("Can't create DOM implementation "+e.getMessage());
  +          return null;
  +        }
           Element root = doc.createElement("font-metrics");
           doc.appendChild(root);
           if (isCid)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +4 -6      xml-fop/src/org/apache/fop/image/Attic/SVGImage.java
  
  Index: SVGImage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/Attic/SVGImage.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- SVGImage.java	11 Sep 2001 10:04:25 -0000	1.7
  +++ SVGImage.java	25 Mar 2002 18:08:27 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: SVGImage.java,v 1.7 2001/09/11 10:04:25 keiron Exp $
  + * $Id: SVGImage.java,v 1.7.2.1 2002/03/25 18:08:27 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -40,14 +40,12 @@
       }
   
       /**
  -     * creates a SAX parser, using the value of org.xml.sax.parser
  -     * defaulting to org.apache.xerces.parsers.SAXParser
  +     * get Parser Class name
        *
  -     * @return the created SAX parser
  +     * @return the SAX parser name
        */
       public static String getParserName() {
  -        String parserClassName = Driver.getParserClassName();
  -        return parserClassName;
  +        return org.apache.fop.apps.Driver.getParserClassName();
       }
   
       protected void loadImage() throws FopImageException {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.3  +1 -2      xml-fop/src/org/apache/fop/tools/anttasks/Fop.java
  
  Index: Fop.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/tools/anttasks/Fop.java,v
  retrieving revision 1.14.2.2
  retrieving revision 1.14.2.3
  diff -u -r1.14.2.2 -r1.14.2.3
  --- Fop.java	21 Mar 2002 17:18:05 -0000	1.14.2.2
  +++ Fop.java	25 Mar 2002 18:08:28 -0000	1.14.2.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Fop.java,v 1.14.2.2 2002/03/21 17:18:05 chrisg Exp $
  + * $Id: Fop.java,v 1.14.2.3 2002/03/25 18:08:28 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -333,7 +333,6 @@
                           int renderer) throws FOPException {
           InputHandler inputHandler = new FOInputHandler(foFile);
           XMLReader parser = inputHandler.getParser();
  -        setParserFeatures(parser);
   
           FileOutputStream out = null;
           try {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +29 -12    xml-fop/src/org/apache/fop/tools/xslt/XSLTransform.java
  
  Index: XSLTransform.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/tools/xslt/XSLTransform.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- XSLTransform.java	30 Jul 2001 20:29:35 -0000	1.3
  +++ XSLTransform.java	25 Mar 2002 18:08:28 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: XSLTransform.java,v 1.3 2001/07/30 20:29:35 tore Exp $
  + * $Id: XSLTransform.java,v 1.3.2.1 2002/03/25 18:08:28 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,26 +8,34 @@
   package org.apache.fop.tools.xslt;
   
   import java.io.*;
  -import java.lang.reflect.*;
  +import javax.xml.transform.TransformerFactory;
  +import javax.xml.transform.stream.StreamSource;
  +import javax.xml.transform.stream.StreamResult;
  +import javax.xml.transform.dom.DOMSource;
  +import javax.xml.transform.dom.DOMResult;
  +//import java.lang.reflect.*;
   
   
   public class XSLTransform {
   
       public static void transform(String xmlSource, String xslURL,
                                    String outputFile) throws Exception {
  -        Class[] argTypes = {
  +/*        Class[] argTypes = {
               String.class, String.class, String.class
           };
           Object[] params = {
               xmlSource, xslURL, outputFile
           };
  -        transform(params, argTypes);
  +        transform(params, argTypes);*/
  +      TransformerFactory.newInstance().newTransformer(
  +        new StreamSource(xslURL)).transform(
  +          new StreamSource(xmlSource),new StreamResult(new File(outputFile)));
       }
   
       public static void transform(org.w3c.dom.Document xmlSource,
                                    String xslURL,
                                    String outputFile) throws Exception {
  -        Class[] argTypes = {
  +/*        Class[] argTypes = {
               org.w3c.dom.Document.class, String.class, String.class
           };
   
  @@ -35,25 +43,31 @@
               xmlSource, xslURL, outputFile
           };
           transform(params, argTypes);
  -
  +*/
  +      TransformerFactory.newInstance().newTransformer(
  +        new StreamSource(xslURL)).transform(
  +          new DOMSource(xmlSource),new StreamResult(new File(outputFile)));
       }
   
       public static void transform(String xmlSource, String xslURL,
                                    Writer outputWriter) throws Exception {
  -        Class[] argTypes = {
  +/*        Class[] argTypes = {
               String.class, String.class, Writer.class
           };
           Object[] params = {
               xmlSource, xslURL, outputWriter
           };
           transform(params, argTypes);
  -
  +*/
  +      TransformerFactory.newInstance().newTransformer(
  +        new StreamSource(xslURL)).transform(
  +          new StreamSource(xmlSource),new StreamResult(outputWriter));
       }
   
       public static void transform(org.w3c.dom.Document xmlSource,
                                    InputStream xsl,
                                    org.w3c.dom.Document outputDoc) throws Exception {
  -        Class[] argTypes = {
  +/*        Class[] argTypes = {
               org.w3c.dom.Document.class, InputStream.class,
               org.w3c.dom.Document.class
           };
  @@ -61,10 +75,13 @@
               xmlSource, xsl, outputDoc
           };
           transform(params, argTypes);
  -
  +*/
  +      TransformerFactory.newInstance().newTransformer(
  +        new StreamSource(xsl)).transform(
  +          new DOMSource(xmlSource),new DOMResult(outputDoc));
       }
   
  -
  +/*
       private static void transform(Object[] args,
                                     Class[] argTypes) throws Exception {
           Class transformer = getTransformClass();
  @@ -132,5 +149,5 @@
           }
           return null;
       }
  -
  +*/
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org