Indeed, that's exactly what I did to come up with next and previous siblings
(I wasn't using same-name siblings for other reasons).  It would have been
nice to have some sort of shortcut to avoid iterating over all siblings.

I notice that NodeIterator has a getPosition() method - if that position
were available to the node itself, one could skip() directly to the previous
and next siblings via the NodeIterator from node.getParent().getNodes().

-Brian



On 7/26/07, Christoph Kiehl <[EMAIL PROTECTED]> wrote:
>
> Brian Thompson wrote:
>
> > In my case, it was a web app where each sibling node corresponded to a
> page
> > being displayed, and we needed a paging mechanism (the pages formed a
> > training course).
>
> Since a child node does not know anything about its siblings you will have
> to
> ask the parent which means essentially you have to call
> childNode.getParent().getNodes() and use the resulting iterator to find
> your
> specific child node and then identify its neighbors.
> If you use same name siblings you could also use something like this:
>
> <snip>

Reply via email to