Hi, 
 
I am not sure if I am addressing this query to correct mailing list if not
then please kindly suggest one.
I could not get an answer  at   http://forum.java.sun.com
<http://forum.java.sun.com>  and could not locate any similar  known bug in
bug
database hence I am posting it here, any inconvenience is regretted
Here is my question:
 
When ever I execute following servlet I get following Exception

javax.xml.transform.TransformerConfigurationException : NameSpace not
supported by SAXParser

same code will execute OK from command line as an application.


import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xerces.parsers.DOMParser;
import java.io.*;

public class TransformProduct extends HttpServlet {

public void doGet (HttpServletRequest request,
HttpServletResponse response) 
throws IOException, ServletException {

String XMLSource = "C:/xml_java/basic/products.xml";
String XSLSource = "C:/xml_java/basic/product.xsl";

response.setContentType("text/html");
PrintWriter output = response.getWriter(); 

try{ 
TransformerFactory transformerFactory =
TransformerFactory.newInstance();

FileReader reader = new FileReader(XSLSource);

Transformer transformer = transformerFactory.newTransformer(
<== This line generates the exception
new StreamSource(reader));

DOMParser parser = new DOMParser(); 
parser.parse(XMLSource);
Document document = parser.getDocument();
}
catch(javax.xml.transform.TransformerConfigurationException tce)
{
errString = "tce "+tce.getMessage();
}

catch(Exception e)
{ 
errString = "e "+e.getMessage();
e.printStackTrace();
}

System.out.println(errString);

}//doGet Ends
}//Class Ends

Here is the CLASSPATH settings:

SET CLASSPATH=.;c:\xalan\bin\xerces.jar;c:\xalan\bin\xalan.jar;
SET
CLASSPATH=%CLASSPATH%;c:\tomcat\lib\webserver.jar;c:\tomcat\lib\jasper.jar;
SET
CLASSPATH=%CLASSPATH%;c:\tomcat\lib\xml.jar;c:\tomcat\lib\servlet.jar;c:tomc
at\lib\tools.jar;

I tried xalan-j_2_0_1 and  xalan-j_2_2_D6 ...but no luck 

Any help will be great !!!


Cheers,
SUNIL

 
 

 



This message is confidential and may also be legally privileged.  If you are not the 
intended recipient, please notify us immediately.  You should not copy it or use it 
for any purpose, not disclose its contents to any other person.  The views and 
opinions expressed in this e-mail message are the author's own and may not reflect the 
views and opinions of Wilco International

Reply via email to