This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Error!! transformation from xml to html

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, everyone, i'm running my servlet to do xml transformation using xalan. Everything was running fine until recently i faced the following error.
java.lang.IncompatibleClassChangeError: Unimplemented interface method
at org.apache.xalan.xpath.dtm.DTMNodeVector.(DTMNodeVector.java:69)
at org.apache.xalan.xpath.dtm.DTM.(DTM.java:309)
at org.apache.xalan.xpath.dtm.DTMLiaison.parse(DTMLiaison.java:198)
at org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:955)
at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:643)
at invoice.service(invoice.java:50)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
at org.apache.tomcat.core.Handler.service(Handler.java)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
at java.lang.Thread.run(Thread.java)
my code is as follows:-
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xalan.xslt.*;
import java.util.*;
public class invoice extends HttpServlet {
String path;
public void init(){
ResourceBundle bundle = ResourceBundle.getBundle("invoice");
try{
// Set default path as stated in the properties file.
path = bundle.getString("defaultPath");
}catch(Exception e){}
}
public void service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
throws javax.servlet.ServletException, java.io.IOException
{
/* // default path
String path ="/home/inv/"; */
String in = "";
String sheet = "";
String tempxml = req.getParameter("xmlfilename");
String tempxsl = req.getParameter("xslfilename");
if (tempxml.charAt(0) == '/')
in = tempxml;
else
in = path + tempxml;
if (tempxsl.charAt(0) == '/')
sheet = tempxsl;
else
sheet = path + tempxsl;
// Transform
try {
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(new FileInputStream(in)),
new XSLTInputSource(new FileInputStream(sheet)),
new XSLTResultTarget(res.getOutputStream()));
} catch (Exception e) {
PrintWriter out = res.getWriter();
out.println("Error: " + e + ". ");
out.println("<a href=/osb/invoice/>Try again</a>");
out.close();
}
//return;
}
}
I will be very grateful if someone can tell me wat's wrong.
 
Darryl Andrew
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like xalan2 no longer support XSLTProcessor class.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm not much aware of using XSLTProcessor,XSLTInputSource and XSLTResultTarget.
Have u come across with "xtags" provided by apache.It is one of the easiest one to work with these type of applications.I think it will help you in rectifying your problem.
For more details just visit http://jakarta.apache.org/taglibs/doc/xtags-doc/intro.html
Best regards,
paramaguru
 
Darryl Andrew
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi thanx for the reply, but my company would specifically like to work with what they have now and that is xalan2, so i don't think i have an option here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic