[jdom-interest] How do add a child?

kevin.schmidt at convergys.com kevin.schmidt at convergys.com
Mon Nov 12 11:26:07 PST 2001


I am using JDOM beta 7 and am trying to add one Element to be a child of
another.
I dont see an addChild method in the API for Element.  Also, it wont let me
call setParent
because it is a protected method.  The only way I can see to do it is like
this:

List childs = elem1.getChildren();
childs.add(elem2);
elem1.setChildren(childs);

This seems very roundabout though.  I must be missing something!  Help!

     -Kevin Schmidt
     Cincinnati, OH


--

NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.





More information about the jdom-interest mailing list