[jdom-interest] jdom2 migration issue

Rolf Lear jdom at tuis.net
Mon Aug 20 11:24:32 PDT 2012


In eclipse, edit your file, then type shift-ctrl-T
Then type org.jdom.Document

In the box below, you have all the locations of jdom 1.x Documents.

As a double-check, can you copy/paste the entire import section in your
class.... I am convinced there must be an import from org.jdom.* or
something.

P.S. when you reply, do a reply-all, and I will get your answer
faster.....

Rolf


On Mon, 20 Aug 2012 12:18:29 -0600, "Craig Christophersen"
<craigch at synesis7.com> wrote:
> Hello Rolf; Thank you for your reply.  I have again looked thru stuff
and
> found no old jdom.  Are there known jars(I use several apache) that
would 
> include jdom classes???  I am using eclipse.
> 
> 
> -----Original Message-----
> From: Rolf Lear [mailto:jdom at tuis.net] 
> Sent: Monday, August 20, 2012 11:35 AM
> To: Craig Christophersen
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] jdom2 migration issue
> 
> 
> Hi Craig.
> 
> There must be some other imports from the org.jdom package (as well as
> org.jdom2....).
> 
> The error message you are getting would be impossible unless you have
> those imports.
> 
> Something is wrong in your imports.... and your build path must have
some
> old JDOM classes from places other than just the old JDOM jar.
> 
> Finally, it is normal in GUI-type development tools, (eclipse, IntelliJ,
> etc) to exclude the package on field names.... i.e. the line:
> 
>     protected org.jdom2.Document document;
> 
> would not normally be created by Eclipse/IntelliJ unless your class was
> already using the org.jdom.Document version somewhere. You should
probably
> replace the line with:
> 
>     protected Document document;
> 
> and ensure that you can import Document from org.jdom2 with
> 
>     import org.jdom2.Document;
> 
> Bottom line is that you still have old JDOM classes in your build path,
> and the copde you have shown us us using *both* Document versions
> (org.jdom, as well as org.jdom2).
> 
> Rolf
> 
> 
> 
> 
> 
> On Mon, 20 Aug 2012 09:58:15 -0600, "Craig Christophersen"
> <craigch at synesis7.com> wrote:
>> Hello;
>> 
>> I have been trying to migrate to Jdom2 in an application.  I have
> followed
>> the migration guide but get a type mismatch error.
>> 
>> Snippit below:
>> 
>>    protected org.jdom2.Document document;
>> 
>>  
>> 
>>     private String str = null;
>> 
>>     private String dmString = "";
>> 
>>     String f = "f";
>> 
>>     String t = "t";
>> 
>>     protected DocType dt;
>> 
>>     /**
>> 
>>      * Read the specified File and parse it to create a JDOM tree
>> 
>>      **/
>> 
>>     public ReadDmFile(File dmFile)// throws IOException, JDOMException 
>> {
>> 
>>     {
>> 
>>         System.out.println("File in ReadDm X: " + dmFile);
>> 
>>        
>> 
>>         try {
>> 
>>         SAXBuilder builder =
>> 
>>             new SAXBuilder(); //"org.apache.xerces.parsers.SAXParser"
>> 
>>       
>> 
>>         // Parse the specified file and convert it to a JDOM document
>> 
>>         builder.setIgnoringElementContentWhitespace(true);
>> 
>>         document = builder.build(dmFile);
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> On last line I get "Type mismatch: cannot convert from
> org.jdom2.Document
>> to
>> org.jdom.Document"
>> 
>> The old jdom jar is removed from this project.
>> 
>> Any help would be appreciated.
>> 
>>  
>> 
>> Thanks,
>> 
>>  
>> 
>>  
>> 
>> Craig Christophersen
>> 
>> Software Developer
>> 
>> Synesis7
>> 
>> craigch at synesis7.com


More information about the jdom-interest mailing list