[jdom-interest] JDOM prob
Matthew MacKenzie
matt at xmlglobal.com
Sun Jul 29 19:10:21 PDT 2001
toString() is a method of java.lang.Object, which Element descends
from...so that can't be it. I think Element overrides it, but even if
it didn't, the base class's version would be found.
Could you include the full stack trace? It should contain enough
information to point out where Java thinks the problem is coming from.
As a side note, why are you using DOMBuilder?
-Matt
Ray Shanley wrote:
>I don't know if this is the source of your problem, but the following line
>of code in your example
>seems to have a problem...
>
>> String s = imageElement.toString();
>>
>
>imageElement is defined as a JDOM Element. I do not see toString() as a
>valid method of Element.
>If you are trying to obtain the text of the Element, I believe that proper
>method would be either
>getText() or getTextTrim()....
>
>Hope this helps...
>
>Regards;
>
>Ray Shanley
>
>
>
>-----Original Message-----
>From: jdom-interest-admin at jdom.org
>[mailto:jdom-interest-admin at jdom.org]On Behalf Of - XërôKòól -
>Sent: Sunday, July 29, 2001 12:16 PM
>To: jdom-interest at jdom.org
>Subject: [jdom-interest] JDOM prob
>
>
>
>hello,
>
>>i have a problem running JDOM apps. i've a error that states:
>>java.lang.NoSuchMethodError.
>>i have read the faq page at JDOM site and adjustments to my classpath but i
>>still cannot run JDOM
>>
>apps.
>
>>please help. thank you.
>>
>>the following files are in my java standard extension dir:
>>servlet.jar, xalan.jar, xerces.jar(xerces.jar comes with JDOM
>>
>download)
>
>>the following is my CLASSPATH setting:
>>
>d:\jdk\bin;d:\jdom\lib\xerces.jar;d:\jdom\build\jdom.jar;d:\xerces-1_2_3\xer
>ces.jar;d:\xalan\bin\xalan.jar;
>
>>the following is the code i'm trying to run:
>>import java.io.*;
>>import java.io.File;
>>
>>import org.jdom.*;
>>import org.jdom.input.*;
>>import org.jdom.output.*;
>>
>>public class AddCode
>>{
>> public AddCode(String filename)
>> {
>> DOMBuilder builder = new DOMBuilder();
>> Document doc;
>> Element root, imageElement;
>>
>> try
>> {
>> FileInputStream in = new FileInputStream(new
>>
>File("d:\\project\\svg\\"
>
>>+filename));
>> try
>> {
>> doc = builder.build(in);
>> root = doc.getRootElement();
>> imageElement = GetImageElement(root);
>> String s = imageElement.toString();
>> System.out.println(s);
>>
>> }
>> catch(JDOMException e)
>> {
>> System.out.println(e);
>> }
>>
>> in.close();
>>
>> }
>> catch (IOException ioe)
>> {
>> ioe.printStackTrace();
>> }
>> }
>>
>> public Element GetImageElement(Element e)
>> {
>> Element child, grandChild;
>>
>> child = e.getChild("g");
>> grandChild = child.getChild("image");
>>
>> return grandChild;
>>
>> }
>>
>>}
>>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
>t.com
>
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
More information about the jdom-interest
mailing list