Hi Guys,
I hv written a
servlet which shd throw an html BY PROCESSING xml+xsl as follows.
import org.xml.sax.SAXException;
import com.sun.xml.tree.*;
import com.jclark.xsl.dom.Transform;
import com.jclark.xsl.dom.TransformEngine;
import com.jclark.xsl.dom.TransformException;
import com.jclark.xsl.dom.XSLTransformEngine;
import org.xml.sax.InputSource;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
public class AccountDemo extends HttpServlet
{
public void doGet(HttpServletRequest rq,HttpServletResponse rs)throws ServletException,IOException
{
try
{
System.out.println("hello");
rs.setContentType("text/html");
PrintWriter p=rs.getWriter();
System.out.println("hello1");
XmlDocument result = new XmlDocument();
System.out.println("hello2");
new XSLTransformEngine()
.createTransform(XmlDocument.createXmlDocument (new InputSource( new FileInputStream("http://localhost:8082/servlet/account.xsl") ), false) )
.transform(XmlDocument.createXmlDocument(new FileInputStream("http://localhost:8082/servlet/account.xml"),false), result);
System.out.println("hello3");
OutputStream out = new FileOutputStream("account1.html");
System.out.println("hello4");
result.write(out);
out.close();
}
catch(Exception e){}
}
}
I am running this prog thru
TOMCAT on port 8082.But the servlet is processed upto "hello2" only.
It means either it is not accessing the file account.xml& xsl FROM THE WEB-INF/CLASSES dir where servlet is resideing.I hv also tried putting the xml+xsl in ROOT.But still it is not processed.
Can anyone help me solving this.Its very important for me as this will save me creating separate XSL for netscape as servlet will throw an HTML which can be viewed thru netscape also.
By,
Manish