[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Exception when using Xalan in Servlet to produce an html-response:org.w3
- From: "I.Eck" <post@i...>
- To: xml-dev@l...
- Date: Wed, 16 May 2001 16:55:07 +0200
Hi
I use newest xalan and jaxp-version and tried to
transform xml to html in a servlet.
This exception occured:
java.lang.NoSuchMethodError: org.w3c.dom.Node:
method getLocalName()Ljava/lang/String; not
found at
org.apache.xalan.templates.TemplateList.getHead(TemplateList.java:471)
at org.apache.xalan.templates.TemplateList.getTemplate(TemplateList.java,
Compiled Code) at
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.java,
Compiled Code) at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:193)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java,
Compiled Code) at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2097)
at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2029)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java,
Compiled Code) at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:479)
That's the code:
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
PrintWriter out = new
PrintWriter (response.getOutputStream()); // The servlet
returns HTML.
response.setContentType("text/html"); out.write("props " +
System.getProperties()); try
{ TransformerFactory tFactory =
org.apache.xalan.processor.TransformerFactoryImpl.newInstance();
// Get the XML input document and the
stylesheet. Source xmlSource = new
StreamSource(new
URL("file:c:/foo.xml").openStream()); Source
xslSource = new StreamSource(new
URL("file:c:/foo.xsl").openStream()); //
Generate the transformer. Transformer
transformer =
tFactory.newTransformer(xslSource); // Perform
the transformation, sending the output to the
response. transformer.transform(xmlSource, new
StreamResult(out)); } catch
(Exception e) {
out.write(e.getMessage());
e.printStackTrace(out);
} out.close(); }
As I have problems in using xerces instead of
xalan, I tried to refer to the implementation classes directly.
foo.xml and foo.xsl are examples of the
xalan-distribution and they do exist in this directory.
I use Tomcat 3.2.1 and Apache.
Any ideas what might have gone wrong??
That's the minimalistic exapmle, think that must be
O.K:
<?xml version="1.0"?> <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="doc"> <result>Das
Ergebnis</result> <out><xsl:value-of
select="."/></out>
</xsl:template> </xsl:stylesheet>
Thanks for your help!
Inga
|
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|