[jdom-interest] Placing Content in a Document

steven.gould at cgiusa.com steven.gould at cgiusa.com
Tue Feb 13 08:21:04 PST 2001


Otavio,

Use List children = document.getRootElement().getChildren() to get a
list of all the child elements. Then use regular Java2 List operations
to add, remove and even move the child elements within that List. The
parent document will reflect any changes you make to the List.

Steve

---

Otavio Rezende da Silva wrote:

> Hello all, I am trying to add child Elements into a Document
> using:document.getRootElement().addContent( element ); The element is
> always inserted as the last child of the RootElement. Is there any way
> of choosing the position of the new element inside its parent element
> when it is inserted? Cheers, Otavio  ============================
>  Otavio Rezende da Silva
>  Grupo TecComm - PUC-Rio
>  Tel: (21) 540-6915 r 110
> ============================



More information about the jdom-interest mailing list