Hello All:

I'm sure this has been addresses before, so please forgive me.

I am trying to use the classic 3 line TraX transformation of an xml file
using XSLT.  The following code works fine as a stand alone
application, but the minute I try to invoke the same thing from a JSP I get
the error:

System property org.xml.sax.driver not specified

Can anyone tell me how to fix this?

Here's the code:

package com.wappearances.Beans.Transformer;
import java.util.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import java.io.*;

public class TransformerBean implements Serializable {
         protected String xmlFileName;
         protected String xslFileName;

         public TransformerBean() {
         }

         public String getXmlFileName(){
                 return xmlFileName;
         }

         public void setXmlFileName(String _xmlFileName){
                 xmlFileName = _xmlFileName;
         }

         public String getXslFileName(){
                 return xslFileName;
         }

         public void setXslFileName(String _xslFileName){
                 xslFileName = _xslFileName;
         }

         public String transform(StreamResult result)
                         throws TransformerException,
TransformerConfigurationException, IOException
         {
                 StreamSource xml = new StreamSource(new File(xmlFileName));
                 StreamSource xsl = new StreamSource(new File(xslFileName));

                 try {
                         TransformerFactory tf =
TransformerFactory.newInstance();
                         Transformer transformer = tf.newTransformer(xsl);
                         transformer.transform(xml, result);
                 }
                 catch (Exception e) {return (e.getMessage());}
                 return null;
         }
}

---------------------------------------------------------------------------------------------------------------------
Robert Burdick
Author, "Essential Windows CE Application Programming", John Wiley and Sons
Co-author, "Professional JSP, 2nd Edition", Wrox Press

[EMAIL PROTECTED]
www.wAppearances.com
(650)-917-8446 (office)
(650)-906-3707 (cell)

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to