You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by dc...@decinf.it on 2002/05/13 17:08:18 UTC
Hello, I'm having a problem in generation Html by translets
Hello,
i'm creating a jsp generatin an XML Document with Xerces 2.0 and have to
generate html passing by a Translet compiled.
Now i have yet compiled my XSL in a Translet Class then with this code i
want to generate Html.
Thank you in advance Daniele
###################################################################
String key = "javax.xml.transform.TransformerFactory";
String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
Properties props = System.getProperties();
props.put(key, value);
System.setProperties(props);
final SAXParserFactory factory = SAXParserFactory.newInstance();
try {
factory.setFeature(Constants.NAMESPACE_FEATURE, true);
}
catch (Exception e) {
factory.setNamespaceAware(true);
}
final DOMImpl dom = new DOMImpl();
dom.setDocumentURI(doc.getNamespaceURI());
XMLReader reader = null;
SAXParser parser = null;
DTDMonitor _dtdMonitor = new DTDMonitor();
try {
parser = factory.newSAXParser();
reader = parser.getXMLReader();
reader.setContentHandler(dom.getBuilder());
_dtdMonitor.handleDTD(reader);
reader.parse(doc.getNamespaceURI());
}
catch (ParserConfigurationException e) {
System.err.println("SAX Parser is not configured properly.\n"+
e.getMessage());
System.exit(1);
}
catch (SAXException e ) {
System.err.println("SAX Parser could not be created.\n"+
e.getMessage());
System.exit(1);
}
catch (IOException e ) {
System.err.println("XML Reader could not read xml document '"+
doc.getNamespaceURI() + "'," + e.getMessage());
System.exit(1);
}
try
{
Class tc = Class.forName("gc_inserimento");//The name of the class
containig the xsl compiled
AbstractTranslet translet = (AbstractTranslet)tc.newInstance();
DefaultSAXOutputHandler saxHandler = new
DefaultSAXOutputHandler(out);
translet.transform(dom,new TextOutput(saxHandler));
}
catch(Exception e)
{
e.printStackTrace();
out.println("FALLITO PARSING XSLT a causa dell'eccezione: ");
out.println(e.toString());
}
##########################################################à
The exception presented by the Application Server (BEA Weblogic) is:
javax.xml.parsers.FactoryConfigurationError: Provider for
javax.xml.parsers.SAXParserFactory cannot be found
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
at IB._etadec_script._pagamenti._giroconto.__gc_inserimento.
_jspService(__gc_inserimento.java:2288)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:941)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:905)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:391)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:273)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
############################################
I think the exception is thrown at the time of the newInstance() of the
saxParserFactory...
Have you got any tips??? Thank you !!!