[jdom-interest] Moving Subtrees using JDOM
joan at ermis.com
Sat Feb 23 11:15:21 PST 2002
As I said before, but apparently there is a debate lurking in there, the best solution, IMHO, would be to have a common interface for Element, Text, CDATA, etc. where the detach() method would be defined (among a few others). This would greatly simplify the casting operation in the loop over the List, and add some structure to the API.
The impact would be null, and the benefits quite interesting. And the interface could be written in just a few minutes.
But then again, I have been told that the debate shouldn't be started all over again... :)
*********** REPLY SEPARATOR ***********
On 2002-02-23 at 10:59 Jason Hunter wrote:
>Elliotte Rusty Harold wrote:
>> At 5:57 AM -0800 2/23/02, Noam Tamim wrote:
>> >So how about adding the suggested elt.addContent(List) that will
>> >that list, do all the casts needed, detach whatever needs detaching,
>> >it to elt?
>> >Should be a simple method, I think. Only thing to consider is if it
>> >a method of Element, or a utility method in jdom.contrib.
>> Either way, this is tricky. For instance, what if something in the
>> list doesn't need to be detached?
>Well, detach() is a no-op for parentless objects.
>The downside with the auto-detach idea is that addContent(Element)
>doesn't auto-detach and will throw if you try to add a parented object.
>addContent(List) shouldn't behave differently. And my gut instinct is
>addContent(Element) shouldn't be changed to remove children from
>To control your jdom-interest membership:
More information about the jdom-interest