Hello,
I think you can do this. Try this:

Element featureElement = document.getRootelement();
Element newElement = DocumentHelper.createElement("new-element");
featureElement.content().add(4, newElement);

Best regards

Filip Jirsák



2010/8/4  <fr...@gmx.net>:
> Hello,
>
> is there any possibility to insert an sibiling node in DOM4J?
>
> I've got an XML like that:
>
> <feature>
>  <Element Level 1>
>  <Element Level 2/>
>  </Element Level 1>
>  <Element Level 1/>
>  <here I like to insert my new Element>
>  <Element Level 1/>
> [...]
> </feature>
>
> So I need a possibility to insert an Element on this exact position but I 
> can't find a solution.
>
> I can attach an Element at the beginning and the end of the 
> <feature>-Container and also as child-Element to an spezific Element in the 
> XML. But I can't find a way to insert it between two sibilings.
>
> Does anyone know a solution and might even give some code which could be 
> helpful?
>
> Thanks and best regards,
> André
> --
> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> dom4j-user mailing list
> dom4j-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to