/** * Retrieves an <code>Iterator</code> matching the <code>preceding-sibling</code> XPath axis. * * @param contextNode the original context node * @return Returns an Iterator capable of traversing the axis, not null. * @throws UnsupportedAxisException if the semantics of the preceding-sibling axis are not * supported by this object model */ public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException { ArrayList list = new ArrayList(); if (contextNode != null && contextNode instanceof OMNode) { while (contextNode != null && contextNode instanceof OMNode) { contextNode = ((OMNode) contextNode).getPreviousOMSibling(); if (contextNode != null) list.add(contextNode); } } return list.iterator(); }
public Node getPreviousSibling() { if (prev == null) { if (node.getParent() instanceof OMDocument) { OMNode n = node.getPreviousOMSibling(); do { if (!(n instanceof OMText)) { prev = fac.getNode(n); break; } n = n.getPreviousOMSibling(); } while (true); } else { prev = fac.getNode(node.getPreviousOMSibling()); } } return prev; }
public <T extends Element> T getPreviousSibling() { OMNode el = this.getPreviousOMSibling(); while (el != null) { if (el instanceof Element) return (T)getWrapped((Element)el); else el = el.getPreviousOMSibling(); } return null; }
return; node = node.getPreviousOMSibling();