[jdom-interest] why can't i doelementB.getContent().addAll(elementA.getContent())??

Jason Hunter jhunter at servlets.com
Thu Aug 22 22:18:11 PDT 2002


Yes, there should be a convenience method for that.  It's my goal to see
one added.

-jh-

Phillip Rhodes wrote:
> 
> I want to move the content of Element A  to Element B
> 
> Example
> 
> Element elementA = getElementMethod();
> Element elementB = new Element("newelement");
> List listA = elementA.getContent();
> elementB.getContent().addAll(listA);
> 
> The following will generate an error since the Elements, Text, CData
> objects have not been detached from the parent (elementA).  While I know I
> can loop through the list, and test for the type of object it is and call
> the detach method, I wonder if there is a easier way.  Don't you think
> there should be a convenience method somewhere to do this type of operation?
> Thanks!
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list