Hi Gert, Am Mittwoch, den 19.03.2008, 20:16 +0100 schrieb Gert Vanthienen: > Felix, > > Thanks for your answers. Just one additional question on the following... > > >> Another ESP question: is there a way to get only a limited number of > >> children of a given node? For my ServiceMix monitoring solution, I > >> would prefer to get only the last 50 or so MessageExchanges on the list > >> by default. If a user requires older logging, he should be able to look > >> it up afterwards, but for now a limited list would do fine. > >> > > > > No, there is no such thing. As I said, we just replicate the JCR API. > > And because the JCR API has no such functionality, the JavaScript > > pendants don't have this functionality either. The only solution is to > > iterate over the list upto the children you want to use > I suppose iterating is the only solution as didn't find a way to access > the list of nodes as if it were an array, Is there perhaps a way to > specify the order for the nodes being retrieved -- just trying to avoid > having to iterate over a lot of nodes we don't need?
The JCR API defines the Node.getNodes() method which returns a NodeIterator over all child nodes. Generally the order of the nodes is the order of addition, that is first nodes first. (If the parent node has orderable child nodes, the node order may be changed, but this is probably not the case here). There is no direct way of reversing that order and so you have to iterate over all nodes and just use those you like - that is ignore the first nodes in the iterator. Regards Felix
