Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JAVA XALAN ERROR HELP PLS

0 views
Skip to first unread message

Syed Mujtaba

unread,
May 18, 2001, 6:44:40 AM5/18/01
to
Hello,
below is a test java program i wrote to test xalan. The code compiles
fine, but then i run it, I get the errors which I have copied and pasted
below the code. Clearly the classpaths for xalan.jar are properly set or the
code would not compile. Any help would be greatly appreciated. Basically
this is the code that comes with the examples that come with xalan. The only
jar files I have in my classpath are tools.jar, xerces.jar, and xalan.jar
Thank

import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class TestTransform{
public static void main(String[] args)
throws TransformerException, TransformerConfigurationException,
FileNotFoundException, IOException{

String xml_input = "c:/testXML/test.xml";
String html_output = "c:/testXML/test.html";

TransformerFactory tFactory = TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = tFactory.newTransformer(new
StreamSource("c:/testXML/internal.xsl"));
transformer.transform(new StreamSource(xml_input), new StreamResult(new
FileOutputStream(html_output))); //this is the line causing the errors
System.out.println("************* The result is in birds.out
*************");
}
}


The errors i get are:
java.lang.NoSuchMethodError
at org.apache.xpath.DOM2Helper.getLocalNameOfNode(DOM2Helper.java:326)
at org.apache.xalan.templates.TemplateList.getHead(TemplateList.java:471)
at
org.apache.xalan.templates.TemplateList.getTemplate(TemplateList.java:528)
at
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja
va:432)
at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.jav
a:193)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
erImpl.java:2202)
at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
Impl.java:2085)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1219)
at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2942)
at java.lang.Thread.run(Thread.java:484)
************* The result is in birds.out *************
Interactive Session Ended


Maris Orbidans

unread,
May 23, 2001, 5:45:38 PM5/23/01
to

You may have an old xerces.jar in your classpath.

Class org.w3c.dom.Node should have following method:

/**
* Returns the local part of the qualified name of this node.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
* method, such as <code>createElement</code> from the
* <code>Document</code> interface, this is always <code>null</code>.
* @since DOM Level 2
*/
public String getLocalName();


Or you can use JAXP.
I compiled your code with it.


Maris
Baltic Technology Group

0 new messages