/** * Create a new <code>descendant</code> axis iterator. * * @param contextNode the node to start from * @param navigator the object model specific navigator */ public DescendantAxisIterator(Object contextNode, Navigator navigator) throws UnsupportedAxisException { this(navigator, navigator.getChildAxisIterator(contextNode)); }
/** * Gets the iterator for the child axis. * * @param contextNode the current context node to work from * @param support the additional context information * @return an iterator over the children of the context node * @throws UnsupportedAxisException if the child axis is not supported */ public Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException { return support.getNavigator().getChildAxisIterator(contextNode); }
private void init() throws UnsupportedAxisException { Object parent = this.navigator.getParentNode( this.contextNode ); if ( parent != null ) { siblingIter = this.navigator.getChildAxisIterator( parent ); while ( siblingIter.hasNext() ) { Object eachChild = siblingIter.next(); if ( eachChild.equals(this.contextNode) ) break; } } else { siblingIter = JaxenConstants.EMPTY_ITERATOR; } }
private ListIterator childrenOrSelf(Object node) { try { ArrayList reversed = new ArrayList(); reversed.add(node); Iterator childAxisIterator = navigator.getChildAxisIterator(node); if (childAxisIterator != null) { while (childAxisIterator.hasNext()) { reversed.add(childAxisIterator.next()); } } return reversed.listIterator(reversed.size()); } catch (UnsupportedAxisException e) { throw new JaxenRuntimeException(e); } }
private void init() throws UnsupportedAxisException { Object parent = this.navigator.getParentNode( this.contextNode ); if ( parent != null ) { Iterator childIter = this.navigator.getChildAxisIterator( parent ); LinkedList siblings = new LinkedList(); while ( childIter.hasNext() ) { Object eachChild = childIter.next(); if ( eachChild.equals(this.contextNode) ) { break; } siblings.addFirst( eachChild ); } this.siblingIter = siblings.iterator(); } else { this.siblingIter = JaxenConstants.EMPTY_ITERATOR; } }
/** * Returns the next descendant node. * * @return the next descendant node * * @throws NoSuchElementException if no descendants remain * * @see java.util.Iterator#next() */ public Object next() { try { if (hasNext()) { Object node = children.next(); stack.add(children); children = navigator.getChildAxisIterator(node); return node; } throw new NoSuchElementException(); } catch (UnsupportedAxisException e) { throw new JaxenRuntimeException(e); } }
Iterator childAxisIterator = nav.getChildAxisIterator(obj); while (childAxisIterator.hasNext())