[jdom-interest] setcontent and removecontent methods
Bradley S. Huffman
hip at cs.okstate.edu
Sat Oct 18 06:35:35 PDT 2003
With the latest CVS, if you want to move element A's content to element B
B.setContent(A.removeContent()); // Replaces element B's content
or
B.addContent(A.removeContent()); // Appends to end of element B's content
if you want to copy A's content instead of removing it, use cloneContent()
instead of removeContent().
Brad
"A S" writes:
> Hi,
>
> I am facing the following problem related to manipulating the content of an e
> lement.
>
>
> Basically, I have element A, i want to take its content and add it as the con
> tent of element B.
> However, I am not able to do that right now
>
> briefly,
>
> org.jdom.Element cloneElement= (org.jdom.Element)element.clone();
> cloneElement.detach();
> element.setContent(null);
> org.jdom.Element spanElement= new org.jdom.Element("span");
> java.util.List clist=cloneElement.getContent();
> logger.info("got children list from clone , size "+ clist.size() );
> spanElement.setContent(clist);
>
> this throws an exception
>
>
>
>
>
> ____________________________________________________________
> Enter for a chance to win one year's supply of allergy relief!
> http://r.hotbot.com/r/lmt_clrtn/http://mocda3.com/1/c/563632/125699/307982/30
> 7982
> _______________________________________________
> 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