Problem in Transformation of an XML.
Hi All,
I am trying to Transform an xml object using the XSL file using servlet.
1)Created an object for TransformFactory listed below.
TransformerFactory xsltFactory = TransformerFactory.newInstance();
2) Created a Source object and the code is listed below:
Source strXslSource = null;
try{
strXslSource = new StreamSource(new File(xslFilePath));
}
catch(Exception exp)
{
exp.printStackTrace();
}
3) Then tried to create the Transformer object with the line by passing Source object which represents XSL file.
Transformer transformer = xsltFactory.newTransformer(strXslSource);
4) Finally trying to flush the data as shown below:
try {
InputStream in = httpservletrequest.getInputStream();
Source source= new StreamSource(in);
PrintWriter out = httpservletresponse.getWriter();
Result result= new StreamResult(out);
transformer.transform(source, result);
httpservletresponse.flushBuffer();
}
Facing the problem while creating the Transformer object and the exception is listed below:
EXCEPTION MESSAGE :Message : javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.SAXParserFactory cannot be found
Exception Stack Trace
javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.SAXParserFactory cannot be found
at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:816)
Can any one please give me the solution to the problem.
Sonashree.

