The Element API doesn't provide support for what you want to do, however you could try it using the List API on the content of the parent element:

For instance:

Element parent = ...
Element a = ...
Element b = ...

List contentOfParent = parent.content();
int index = contentOfParent.indexOf(a);
contentOfParent.set(index, b);

regards,
Maarten

[EMAIL PROTECTED] wrote:


Hello,
how would i replace an element A with element B,
without changing the order of the tree. ( i don't want to A.detach() and A.parent()add(B) because this will cause B to be the last child and not the kind of child A was)
in other words, how do i do this :
(Element) a. replace(b);




-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to