[jdom-interest] insert

Ken Rune Helland kenh at csc.no
Thu Mar 22 04:00:14 PST 2001


At 02:34 AM 3/22/2001 -0800, elephantwalker wrote:
>don't know this for sure, but is there a way to "insert" and element in a
>particular order?
>
>if I have elements:
>
><a>
>  the beginning
></a>
><c>
>  the end
></c>
>
>And I would like to insert <b>the middle</b> in between <a> and <c>, how is
>it done?
>
>Regards,
>
>Elephantwalker


Get the parent/root element (herafter called parent).

use:

java.util.List content =  parent.getChildren()

or:

java.util.List content =  parent.getMixedContent()

and insert it into the content list at the desired possition
using normal list metods.

See the doc for the difference between getChildren() and getMixedContent().

Best Regards
KenR


  




More information about the jdom-interest mailing list