<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<p>I have a very innocent looking code like this one. All I want to do
is to print out the contents of my xml file.
<p><tt>import java.io.* ;</tt>
<br><tt>import org.jdom.* ;</tt>
<br><tt>import org.jdom.input.DOMBuilder ;</tt>
<br><tt>import org.jdom.output.XMLOutputter ;</tt><tt></tt>
<p><tt>public class DOMBuilderTest</tt>
<br><tt>{</tt>
<br><tt> public static void main( String[] args ) {</tt>
<br><tt> try {</tt>
<br><tt> DOMBuilder builder = new DOMBuilder()
;</tt>
<br><tt> Document doc = builder.build( new
File( "../linux.xml") ) ;</tt>
<br><tt> XMLOutputter o = new XMLOutputter()
;</tt>
<br><tt> o.output( doc, System.out ) ;</tt>
<br><tt> }</tt>
<br><tt> catch( IOException e ) {</tt>
<br><tt> e.printStackTrace() ;</tt>
<br><tt> }</tt>
<br><tt> catch( JDOMException e ) {</tt>
<br><tt> e.printStackTrace() ;</tt>
<br><tt> }</tt>
<br><tt> }</tt>
<br><tt>}</tt>
<p>After compiling this code, when I tried to run it, it gave me a run-time
exception that reads as follows.
<p><tt>Exception in thread "main" java.lang.NoSuchMethodError: org.w3c.dom.DocumentType:
method</tt>
<br><tt>getPublicId()Ljava/lang/String; not found</tt>
<br><tt> at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java,
Compiled Code)</tt>
<br><tt> at org.jdom.input.DOMBuilder.buildTree(DOMBuilder.java,
Compiled Code)</tt>
<br><tt> at org.jdom.input.DOMBuilder.build(DOMBuilder.java,
Compiled Code)</tt>
<br><tt> at org.jdom.input.DOMBuilder.build(DOMBuilder.java,
Compiled Code)</tt>
<br><tt> at JDOMTest.domDocument(JDOMTest.java,
Compiled Code)</tt>
<br><tt> at JDOMTest.main(JDOMTest.java,
Compiled Code)</tt>
<p>I have set my CLASSPATH like this.
<p><tt>/my_home/jdom/build/jdom.jar:/my_home/xerces/xerces.jar:\</tt>
<br><tt>/opt2/oraclient/sqlj/lib/translator.zip:/opt2/oraclient/jdbc/lib/classes12.zip:\</tt>
<br><tt>/opt2/oraclient/jdbc/charset12.zip:/opt2/j2sdkee1.2.1/lib/j2ee.jar:\</tt>
<br><tt>/opt2/jdk1.2.2/lib/tools.jar:/opt2/jdk1.2.2/lib/dt.jar:/home/tad:/opt2/tomcat/classes:.</tt>
<p>
<p>As for jdom.jar, I am using beta5. Also tried beta4. As for xerces.jar,
I tried with 1.2.3, 1.2.1 and the version that came with jdom download.
They all resulted
<br>in the same result.
<p>Any help will be very much appreciated.
<p>Thanks,
<br>Tad
<br>
<br> </html>