jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Thompson" <elephant...@gmail.com>
Subject Re: neighboring node
Date Fri, 27 Jul 2007 14:37:04 GMT
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 <christoph@sulu3000.de> 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>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message