[jdom-interest] detach() [eg]

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Wed Apr 25 06:44:59 PDT 2001


The only problem is that 1 and 2 don't make sense if used together.

Also 2 won't work because 2 child elements could be identical so how to
differentiate ?

Perhaps you should go back to coding and let the expert (bickerers) carry on
arguing ;-)

-----Original Message-----
From: philip.nelson at omniresources.com
[mailto:philip.nelson at omniresources.com]
Sent: 25 April 2001 13:57
To: jdom-interest at jdom.org
Subject: RE: [jdom-interest] detach() [eg]


> I can do better than both of these :-)
> 
> Utilities.move(elementToBeMoved, newParentElement);
> 
> A method like this can of course encapsulate either the one line 
> version or the 10 line version.
> 
> We can overload both arguments quite heavily to take care of all the 
> different things we might want to move (Elements, Comments, 
> ProcessingInstructions, etc.). We could even add an optional third 
> argument to specify at what position in the new place we wanted the 
> moved thing put.

Is it just me, or this starting to look like some sort of transformation api
:-)

Of course this would work.  But to handle this one simple little case?  Your
idea of putting detach on Document is simpler.  And until a more general
purposes set of classes becomes a more important part of the api, what would
make me look there to get this done?

It seems to me we have a growing consensus here.

1 - detach becomes the responsibility of the parent and takes an argument of
the content to be detached.
2 - detaching a root element from document will put the document into an
illegal state and the IllegalStateException will be thrown by getRootElement
and getMixedContent
3 - after the root element is detached, it will internally be set to null.

So, can I go back to coding again?
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list