RE: [xsl] SAXException..

Subject: RE: [xsl] SAXException..
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 4 Jul 2002 09:15:19 +0100
First thing to do is to establish beyond doubt which XML Parser is being
loaded. This problem occurs when the XSLT processor requests a parsing
feature that the XML parser doesn't support, and in tomcat this usually
happens because the system is set up to load the wrong parser.

Using System.setProperty("javax.xml.parsers.SAXParserFactory", ...) can
help to ensure you get the parser you want.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Krishnam Raju
> Sent: 04 July 2002 05:33
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] SAXException..
> 
> 
> Hi all,
> 
>    Small help.
>    
>    I have written the following code in servlet.
> 
> 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 javax.servlet.http.*;
> import javax.servlet.*;
> 
> 
> // Imported java classes
> import java.io.FileOutputStream;
> import java.io.FileNotFoundException;
> import java.io.*;
> 
> public class SimpleTransform1 extends HttpServlet
> {
> 	public void doGet(HttpServletRequest 
> req,HttpServletResponse res)throws ServletException,IOException
>     
>   {  
> 	PrintWriter out = res.getWriter();
> 	out.println("Inside the doget method");
>   		try{
> 		createXml(res);
> 		}catch(Exception e){System.out.println("Inside 
> the Exception
> : "+e.getMessage());}
> 		
> 	
>   }
> 	public void createXml(HttpServletResponse res)throws 
> TransformerException, TransformerConfigurationException, 
>            FileNotFoundException, IOException
> 	{
> 			
> 	TransformerFactory tFactory = TransformerFactory.newInstance();
> 		
> 	Transformer transformer = tFactory.newTransformer(new 
> StreamSource("/xmlexamples/xml/emp.xsl"));
> 
> 	transformer.transform(new 
> StreamSource("/xmlexamples/xml/emp.xml"),
> new StreamResult(new FileOutputStream("/xmlexamples/xml/emp.html")));
> 	}
> }
> 
> 
>    I am using Tomcat4.0  Web server.
>   When I execute this servlet I am gettig the following exception.
> 
>   javax.xml.transform.TransformerConfigurationException:
> javax.xml.transform.TransformerException: 
> org.xml.sax.SAXException: Namespace not supported by SAXParser
>    
> But When I place this code in simple java file, this is 
> working fine.  I have given the following jar files in the class path.
> 
> xerces-2_0_1\xercesImpl.jar;
> xerces-2_0_1\xmlParserAPIs.jar;
> xalan-j_2_3_1\bin\xalan.jar;
> xalan-j_2_3_1\bin\xml-apis.jar; xalan-j_2_3_1\bin\xalanservlet.jar;
> 
> 
> Can any body give me the solution?
> 
> Raju.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread