[jdom-interest] Why don't Comment, Element, Text, etc extend common jdom object?

Gordon Tyler gordon.tyler at sitraka.com
Tue May 28 10:01:41 PDT 2002


----- Original Message -----
From: "bob mcwhirter" <bob at werken.com>


> I'm not disputing that all.  My conflict arises in that we have a
> method called 'detach()', and the documentation for it seems to
> imply it's what you'd use to detach an element.  But, there's 1 case
> where you don't use it, but instead use Iterator::remove().

Then perhaps the Javadoc for detach() would be a good place to mention this
caveat.

> With JDOM's 80/20 rule, it seems like 80% of the folks want to detach
> nodes while iterating, and many of them are coming across this problem.
>
> It's related to the fact that the lists are 'live', which also confuses
> people on a daily basis.

When I was first using JDOM and I wanted to remove elements from a list, the
first thing I tried was iterating through getChildren() and using
Iterator.remove(). Unfortunately, in JDOM beta 7 (or was it 6?) this didn't
work and I had to use a workaround. I rejoice now that it works correctly in
beta 8.

Ciao,
Gordon





More information about the jdom-interest mailing list