/** * Returns the next ancestor-or-self node. * * @return the next ancestor-or-self node * * @throws NoSuchElementException if no ancestors remain * * @see java.util.Iterator#next() */ public Object next() { try { if (hasNext()) { Object result = contextNode; contextNode = navigator.getParentNode(contextNode); return result; } throw new NoSuchElementException("Exhausted ancestor-or-self axis"); } catch (UnsupportedAxisException e) { throw new JaxenRuntimeException(e); } }