[jdom-interest] inserting a child element as the first, or (nth) element ...

Jason Hunter jhunter at collab.net
Sun Aug 13 22:58:56 PDT 2000


> Alright, I give up... what's the easiest way to insert an element 
> somewhere other than at the end of the list of children??

List kids = element.getParent().getChildren();
kids.add(5, newKid);
// etc

You can use getMixedContent() instead of getChildren() if you want to
worry about comments, entities, and other "node" placements.

-jh-



More information about the jdom-interest mailing list