<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>Hi Chris.<div><br></div><div>Don't be too hard on yourself. It is an eclipse problem, and many people have wasted hours on this type of problem. I should update the migration page.</div><div><br></div><div>Pleased it is now working, and I hope it does not sour your JDOM2 experience.</div><div><br></div><div>Rolf</div><div><br></div><div><br></div><br>Craig Christophersen <craigch@synesis7.com> wrote:<br><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Took two cleans to get it all clean.<o:p></o:p></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Changed back:<o:p></o:p></span></p><p class="MsoNormal">final org.jdom2.Document mydoc = builder.build(dmFile);<br> document = mydoc;<o:p></o:p></p><p class="MsoNormal">to:<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p><p class="MsoNormal">document = builder.build(dmFile);<br><br>in that one class.<o:p></o:p></p><p class="MsoNormal">All now compiles.<o:p></o:p></p><p class="MsoNormal">Thank you much for your help……I guess this was more of an eclipse and developer not cleaning his project enough issue.<o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">I look forward to running this application now, and learning more about the enhancements in jdom2.<o:p></o:p></p><p class="MsoNormal">Thank you again, Craig<br><br> <span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Rolf Lear [mailto:jdom@tuis.net] <br><b>Sent:</b> Monday, August 20, 2012 2:06 PM<br><b>To:</b> craigch@synesis7.com<br><b>Cc:</b> jdom-interest@jdom.org<br><b>Subject:</b> RE: [jdom-interest] jdom2 migration issue<o:p></o:p></span></p></div></div><p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">In eclipse do a 'clean' on your project...<o:p></o:p></p><div><p class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">Perhaps there are some 'vestiges' of a previous eclipse build.<o:p></o:p></p></div><div><p class="MsoNormal"><o:p> </o:p></p></div><div><p class="MsoNormal">Rolf<o:p></o:p></p></div><div><p class="MsoNormal"><o:p> </o:p></p></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>Craig Christophersen <craigch@synesis7.com> wrote:<br>This is very peculiar. That line now compiles.<br>But further down in the class is another method using "document" that will not(with the same type mismatch error).<br>The line " Element root = document.getRootElement();” errors.<br>Method:<br> public String getWPNum() throws JDOMException { <br> String wpNum = "";<br> Element root = document.getRootElement();<br> Element idstatus = (Element)root.getChild("idstatus");<br> Element status = (Element)idstatus.getChild("status");<br> Element remarks = (Element)status.getChild("remarks");<br> wpNum = remarks.getText();<br> if(wpNum.equals("")) {<br> wpNum = "0"; <br> }<br> System.out.println("WPNum in Read DM: " + wpNum);<br> <br> return wpNum;<br> }<br><br>-----Original Message-----<br>From: Rolf Lear [mailto:jdom@tuis.net] <br>Sent: Monday, August 20, 2012 1:02 PM<br>To: Craig Christophersen<br>Cc: Jdom interest<br>Subject: RE: [jdom-interest] jdom2 migration issue<br><br><br>Right, then the next thing to do is to worry about the protected variable 'document'.<br><br>In your code you have protected org.jdom2.Document document;<br><br>I had assumed that this was the same variable as the one in the line:<br><br> document = builder.build(dmFile);<br><br>But, now I am not so sure.... perhaps in this case the document in the build line is some other document variable with the same name from a super class or something.<br><br>So, what happens if you replace the build line:<br><br> document = builder.build(dmFile);<br><br>with:<br><br> final org.jdom2.Document mydoc = builder.build(dmFile);<br> document = mydoc;<br><br>Rolf<br><br><br>On Mon, 20 Aug 2012 12:51:33 -0600, "Craig Christophersen"<br><craigch@synesis7.com> wrote:<br>> In the open type window it does show another project in eclipse with <br>> "org.jdom.Document". But it is another project that I will migrate <br>> also once I get it working in this project. The other project is not<br>referenced<br>> by the current project.<br>> <br>> There are 8 classes in the project that use jdom. Below is a typical<br>> import:<br>> <br>> import java.io.*;<br>> import java.util.*;<br>> import java.util.regex.Pattern;<br>> <br>> import org.jdom2.*;<br>> import org.jdom2.filter.ElementFilter; import <br>> org.jdom2.input.SAXBuilder;<br>> <br>> And another class imports:<br>> <br>> import java.io.*;<br>> import java.util.*;<br>> import java.io.File.*;<br>> import java.io.IOException;<br>> import java.util.concurrent.ConcurrentLinkedQueue;<br>> <br>> import javax.xml.parsers.DocumentBuilder;<br>> import javax.xml.parsers.DocumentBuilderFactory;<br>> import javax.xml.parsers.ParserConfigurationException;<br>> <br>> import org.jaxen.JaxenException;<br>> <br>> import org.jdom2.output.*;<br>> import org.jdom2.*;<br>> import org.jdom2.filter.ElementFilter; import <br>> org.jdom2.filter.ContentFilter; import org.jdom2.input.*; import <br>> org.jdom2.xpath.*;<br>> <br>> -----Original Message-----<br>> From: Rolf Lear [mailto:jdom@tuis.net]<br>> Sent: Monday, August 20, 2012 12:25 PM<br>> To: Craig Christophersen; Jdom interest<br>> Subject: RE: [jdom-interest] jdom2 migration issue<br>> <br>> <br>> In eclipse, edit your file, then type shift-ctrl-T Then type <br>> org.jdom.Document<br>> <br>> In the box below, you have all the locations of jdom 1.x Documents.<br>> <br>> As a double-check, can you copy/paste the entire import section in <br>> your class.... I am convinced there must be an import from org.jdom.* <br>> or something.<br>> <br>> P.S. when you reply, do a reply-all, and I will get your answer <br>> faster.....<br>> <br>> Rolf<br>> <br>> <br>> On Mon, 20 Aug 2012 12:18:29 -0600, "Craig Christophersen"<br>> <craigch@synesis7.com> wrote:<br>>> Hello Rolf; Thank you for your reply. I have again looked thru stuff<br>> and<br>>> found no old jdom. Are there known jars(I use several apache) that<br>> would<br>>> include jdom classes??? I am using eclipse.<br>>> <br>>> <br>>> -----Original Message-----<br>>> From: Rolf Lear [mailto:jdom@tuis.net]<br>>> Sent: Monday, August 20, 2012 11:35 AM<br>>> To: Craig Christophersen<br>>> Cc: jdom-interest@jdom.org<br>>> Subject: Re: [jdom-interest] jdom2 migration issue<br>>> <br>>> <br>>> Hi Craig.<br>>> <br>>> There must be some other imports from the org.jdom package (as well <br>>> as org.jdom2....).<br>>> <br>>> The error message you are getting would be impossible unless you have <br>>> those imports.<br>>> <br>>> Something is wrong in your imports.... and your build path must have<br>> some<br>>> old JDOM classes from places other than just the old JDOM jar.<br>>> <br>>> Finally, it is normal in GUI-type development tools, (eclipse,<br>IntelliJ,<br>>> etc) to exclude the package on field names.... i.e. the line:<br>>> <br>>> protected org.jdom2.Document document;<br>>> <br>>> would not normally be created by Eclipse/IntelliJ unless your class <br>>> was already using the org.jdom.Document version somewhere. You should<br>> probably<br>>> replace the line with:<br>>> <br>>> protected Document document;<br>>> <br>>> and ensure that you can import Document from org.jdom2 with<br>>> <br>>> import org.jdom2.Document;<br>>> <br>>> Bottom line is that you still have old JDOM classes in your build <br>>> path, and the copde you have shown us us using *both* Document <br>>> versions (org.jdom, as well as org.jdom2).<br>>> <br>>> Rolf<br>>> <br>>> <br>>> <br>>> <br>>> <br>>> On Mon, 20 Aug 2012 09:58:15 -0600, "Craig Christophersen"<br>>> <craigch@synesis7.com> wrote:<br>>>> Hello;<br>>>> <br>>>> I have been trying to migrate to Jdom2 in an application. I have<br>>> followed<br>>>> the migration guide but get a type mismatch error.<br>>>> <br>>>> Snippit below:<br>>>> <br>>>> protected org.jdom2.Document document;<br>>>> <br>>>> <br>>>> <br>>>> private String str = null;<br>>>> <br>>>> private String dmString = "";<br>>>> <br>>>> String f = "f";<br>>>> <br>>>> String t = "t";<br>>>> <br>>>> protected DocType dt;<br>>>> <br>>>> /**<br>>>> <br>>>> * Read the specified File and parse it to create a JDOM tree<br>>>> <br>>>> **/<br>>>> <br>>>> public ReadDmFile(File dmFile)// throws IOException, <br>>>> JDOMException<br><br>>>> {<br>>>> <br>>>> {<br>>>> <br>>>> System.out.println("File in ReadDm X: " + dmFile);<br>>>> <br>>>> <br>>>> <br>>>> try {<br>>>> <br>>>> SAXBuilder builder =<br>>>> <br>>>> new SAXBuilder(); //"org.apache.xerces.parsers.SAXParser"<br>>>> <br>>>> <br>>>> <br>>>> // Parse the specified file and convert it to a JDOM <br>>>> document<br>>>> <br>>>> builder.setIgnoringElementContentWhitespace(true);<br>>>> <br>>>> document = builder.build(dmFile);<br>>>> <br>>>> <br>>>> <br>>>> <br>>>> <br>>>> <br>>>> <br>>>> On last line I get "Type mismatch: cannot convert from<br>>> org.jdom2.Document<br>>>> to<br>>>> org.jdom.Document"<br>>>> <br>>>> The old jdom jar is removed from this project.<br>>>> <br>>>> Any help would be appreciated.<br>>>> <br>>>> <br>>>> <br>>>> Thanks,<br>>>> <br>>>> <br>>>> <br>>>> <br>>>> <br>>>> Craig Christophersen<br>>>> <br>>>> Software Developer<br>>>> <br>>>> Synesis7<br>>>> <br>>>> craigch@synesis7.com<o:p></o:p></p></div></body>