[jdom-interest] How do I insert an element between 2 others?

Ken Rune Helland kenh at csc.no
Tue Jun 12 09:36:03 PDT 2001


At 05:04 PM 6/12/2001 +0100, adam flinton wrote:
>Dear All,
>
>Imagine I have a DTD which says that I have three elements A, B & C
>
>Let's say all three are *.
>
>Now imagine I have a Doc which has A & C but no B
>
>How Do I insert element B between A & C (i.e. to keep the element order
>correct)?
>
>Adam Flinton
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

Use getChildren() or getMixedContent() on the parent element,
dependig if your parent element have mixedcontent.
These return a live java.util.List.
Use normal List metods to insert where you want.


KenR





More information about the jdom-interest mailing list