Bob,

> Element parent = element.getParent();
> List children = parent.elements();
> int elemLoc = children.indexOf( element );
> Element nextSibling = children.get( elemLoc + 1 );
> Element prevSibling = children.get( elemLoc - 1 );

This won't work either, because indexOf() uses the node list (including
attribute nodes, etc.) whereas elements() returns a list containing only
elements (so index for node list can be used for list containing only
elements).

The only way I got it to work was by searching the element in the
list returned by elements().

..... there must be a better way than this .... in DOM it's just
getPrevious/NextSibling.

Silvain



_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to