You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Rabi Shanker <ra...@hotmail.com> on 2001/05/18 13:56:50 UTC
problems in xalan servlet
hi,
i am trying to generate fo files from xml/xsl files. i tried using xalan-j
in a servlet but i am getting SAX EXception. i am
enclosing the code that i have written to generate the fo files from xml/fo.
could some one please tell me whats wrong in this.
thanx in advance.
regards,
Rabi
i am using tomcat3.2.1,xalan2
import xmltofo.transfer;
import java.io.*;
public class Conv
{
public static void main(String[] args)
{
try{
System.out.println("Hello World!");
//File xmlFile = new File("biabgrun.xml");
//File xslFile = new File("biabgrun.xsl");
//File foFile = new File("biabgrun.fo");
//transfer.Transform(xmlFile,xslFile,foFile);
transfer.Transform("antrag.xml","antrag.xsl","antrag.fo");
}catch(Exception e){System.out.println(e);}
}
}
------------------------------------------
package xmltofo;
import org.apache.xalan.xslt.*;
public abstract class transfer implements XSLTProcessor {
public static void Transform(String xmlSourceURL, String xslURL, String
outputURL)
throws java.io.IOException,
java.net.MalformedURLException,
org.xml.sax.SAXException
{
org.apache.xalan.xslt.XSLTProcessor processor =
org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
org.apache.xalan.xslt.XSLTInputSource xmlSource =
new org.apache.xalan.xslt.XSLTInputSource
(xmlSourceURL);
org.apache.xalan.xslt.XSLTInputSource xslSheet =
new org.apache.xalan.xslt.XSLTInputSource (xslURL);
org.apache.xalan.xslt.XSLTResultTarget xmlResult =
new org.apache.xalan.xslt.XSLTResultTarget
(outputURL);
processor.process(xmlSource, xslSheet, xmlResult); //...the actual
transformation.
}
}
this is giving an error org.xml.sax.SAX EXception: SAX EXception
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: problems in xalan servlet
Posted by René Jensen <lu...@tbkol.dk>.
Citat Rabi Shanker <ra...@hotmail.com>:
> hi,
> i am trying to generate fo files from xml/xsl files. i tried using
> xalan-j
> in a servlet but i am getting SAX EXception. i am
> enclosing the code that i have written to generate the fo files from
> xml/fo.
> could some one please tell me whats wrong in this.
> thanx in advance.
> regards,
> Rabi
>
> i am using tomcat3.2.1,xalan2
>
>
>
> import xmltofo.transfer;
> import java.io.*;
> public class Conv
> {
> public static void main(String[] args)
> {
>
> try{
> System.out.println("Hello World!");
> //File xmlFile = new File("biabgrun.xml");
> //File xslFile = new File("biabgrun.xsl");
> //File foFile = new File("biabgrun.fo");
> //transfer.Transform(xmlFile,xslFile,foFile);
> transfer.Transform("antrag.xml","antrag.xsl","antrag.fo");
> }catch(Exception e){System.out.println(e);}
>
> }
> }
>
>
> ------------------------------------------
>
> package xmltofo;
>
> import org.apache.xalan.xslt.*;
>
>
>
>
> public abstract class transfer implements XSLTProcessor {
>
> public static void Transform(String xmlSourceURL, String xslURL, String
> outputURL)
> throws java.io.IOException,
> java.net.MalformedURLException,
> org.xml.sax.SAXException
>
> {
>
> org.apache.xalan.xslt.XSLTProcessor processor =
>
> org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();
>
>
> org.apache.xalan.xslt.XSLTInputSource xmlSource =
> new org.apache.xalan.xslt.XSLTInputSource
> (xmlSourceURL);
> org.apache.xalan.xslt.XSLTInputSource xslSheet =
> new org.apache.xalan.xslt.XSLTInputSource
> (xslURL);
> org.apache.xalan.xslt.XSLTResultTarget xmlResult =
> new org.apache.xalan.xslt.XSLTResultTarget
> (outputURL);
>
>
> processor.process(xmlSource, xslSheet, xmlResult); //...the actual
> transformation.
>
> }
> }
>
> this is giving an error org.xml.sax.SAX EXception: SAX EXception
>
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
>
Hi there
I have had a problem using a servlet before.
My problem was that tomcat comes with it's own xml-parser. The jar-files for
this parser is prepended to your classpath when you start Tomcat. these jar-
files can contain an older implementation of some of the classes. I fixed it by
changing the startup files for TomCat so that everything it adds to the
classpath is appended instead of prepended.
\\|//
(@ @)
-----oOOo-(_)-oOOo-----
René Jensen
lundeman@tbkol.dk