[jdom-interest] detach() [eg]

philip.nelson at omniresources.com philip.nelson at omniresources.com
Sun Apr 29 18:51:27 PDT 2001

> You could propose we add Document.removeContent(Element) but to be
> clear: that doesn't help us avoid the IllegalStateException 
> condition. 

> You could probably convince me to add Document.removeContent(Element)
> but I'd want it to be in addition to the detach() method on Element
> which I think is necessary to make moving objects simpler.  
> As I said in
> my previous email, I don't like writing triple-case code block for a
> simple move.  You could think of detach() as a convenience which you
> could avoid if you so chose, just like method chaining.  :-)

When you wrote that, it seemed to assume that you were trying to work with
an element in a context where you don't have the document handy.  The triple
case check was the result of having to do getDocument on the element,
correct? When I wrote my examples, I assumed the document was already
available to me and I knew what it contained.

So, a question for those that have implemented this functionality, would you
normally see the element by itself when you detach a root element (Jason's
worst case) or would you do it where you had the document locally?

More information about the jdom-interest mailing list