[jdom-interest] JDom and Java5

Mattias Jiderhamn mj-lists at expertsystems.se
Fri Feb 22 02:42:47 PST 2008


This is good news!
At least a first step towards an official Java5 JDOM version.

I downloaded your JAR and put it in my dev environment. Here are a few 
problems I ran into (which I haven't had time to analyze myself):

When trying to do XSLT from a JDOMSource to a JDOMResult I got this
org.xml.sax.SAXNotSupportedException: Only JDOM Documents are supported 
as input
    at 
org.jdom.transform.JDOMSource$DocumentReader.parse(JDOMSource.java:580)
    at 
com.caucho.xsl.TransformerImpl.parseDocument(TransformerImpl.java:536)
    at com.caucho.xsl.TransformerImpl.transform(TransformerImpl.java:270)
    at 
se.exder.servlet.XslTransformer.transformToDocument(XslTransformer.java:159)
   ...

XPath.selectNodes() now returns a List<Object> rather than an "untyped" 
List. I would be preferrable if it would still return a plain List which 
could be cast to a List<Element> if you know only Elements will be returned.

 /Mattias Jiderhamn


Rolf Lear wrote (2008-02-21 16:28):
> Hi All.
>
> I have ported JDom to use Java constructs throughout the code. I have 
> taken great pains to make the ported library as similar to the 
> existing one as possible. In fact, I believe that, in 99% of the 
> cases, you will probably be able to take the Java5 version and simply 
> recompile your code against the new Jar and have no problems.
>
> At the same time, the code does a full implementation of Generics, 
> removes encumbrances required to support old Java versions (Java1.2, 
> etc.), and generally spruces up some of the ways that some things are 
> done.
>
> The porting has necessitated the rewrite of a number of core sections 
> of code (like ContentList), but there are performance improvements in 
> there too.
>
> Obviously this has been an individual effort with all the pitfalls of 
> 'single-mindedness' in there too. Any criticisms of the code will be 
> welcomed as the intention is to get a good result.
>
> I believe all the nice things in Java5 are now available, especially 
> those using generics where all the methods return correctly typed data 
> like such that constructs like:
>
>    Element root = document.getRootElement();
>    for (Element child : root.getChildren()) {
>        // do something with element child....
>    }
>
> are now possible.
>
> At this stage, the work is done, and I am just trying to determine how 
> much interest there is in such a port.
>
> I have set up an 'unreliable' server (it is my computer at home on a 
> residential cable-modem....) at git.tuis.net where you can:
>
> browse a full repository of the three core JDom projects (jdom, 
> jdom-test, and jdom-contrib):
> http://git.tuis.net/
>
> read a README I put together:
> http://git.tuis.net/jdom/README.Java5.txt
>
> Download the actual source code (zipped or not):
> http://git.tuis.net/jdom/src/
> http://git.tuis.net/jdom/jdom.src.tar.gz
>
> Download the actual jar:
> http://git.tuis.net/jdom/jdom.jar
>
> Review the API Docs:
> http://git.tuis.net/jdom/apidocs/
>
> Those wanting to access the repositories in git format can do so, or 
> those with CVS can access the same repository using the (git-based) 
> CVS proxies:
>
> Thus, if you want to get a hold of the repositories, you can, using git:
>
> git clone git://git.tuis.net/jdom.git
> git clone git://git.tuis.net/jdom-contrib.git
> git clone git://git.tuis.net/jdom-test.git
>
> Or, using (slower) http protocol:
>
> git clone http://git.tuis.net/git/jdom.git
> git clone http://git.tuis.net/git/jdom-contrib.git
> git clone http://git.tuis.net/git/jdom-test.git
>
> Alternatively, you can use cvs (note the somewhat strange CVSROOTs)
>
> cvs -d ":pserver:anonymous at git.tuis.net:/git/jdom.git" co HEAD -d jdom
> cvs -d ":pserver:anonymous at git.tuis.net:/git/jdom-contrib.git" co HEAD 
> -d jdom-contrib
> cvs -d ":pserver:anonymous at git.tuis.net:/git/jdom-test.git" co HEAD -d 
> jdom-test
>
> Depending on the levels of interest in this there will probably be the 
> requirement to migrate these repositories to a more reliable server, 
> etc. We'll cross that bridge if we get to it.
>
> Rolf
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>



More information about the jdom-interest mailing list