List of utility methods to do XML Node Sibiling
Node | getNextNodeSibling(Node node) Get the next non-text sibling after a node. Node sibling = node.getNextSibling(); while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) sibling = sibling.getNextSibling(); return sibling; |
Node | getNextSibling(Node node) get Next Sibling Node sibling = node.getNextSibling(); while (sibling != null && isWhitespace(sibling)) { sibling = sibling.getNextSibling(); return sibling; |
Element | getNextSiblingElement(Node n) Gets the next sibling Element of the node, skipping any Text nodes such as whitespace. Node sib = n.getNextSibling(); while (sib != null && sib.getNodeType() != Node.ELEMENT_NODE) { sib = sib.getNextSibling(); if (sib != null) { return (Element) sib; } else { return null; ... |
Element | getNextSiblingElement(Node n, String ns, String localName) Gets the next sibling Element of the node of the given name, skipping any Text nodes such as whitespace. Element e = getNextSiblingElement(n); while (e != null && !isElementNamed(e, ns, localName)) e = getNextSiblingElement(e); return e; |
Element | getNextSiblingElement(Node node) get Next Sibling Element Node nextSibling = node.getNextSibling(); while (nextSibling != null) { if (nextSibling.getNodeType() == Node.ELEMENT_NODE) { return (Element) nextSibling; nextSibling = nextSibling.getNextSibling(); return null; ... |
Element | getNextSiblingElement(Node node) Get the next sibling Element of the supplied node. Node sibling = node.getNextSibling(); while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) { sibling = sibling.getNextSibling(); return (Element) sibling; |
Element | getNextSiblingElement(Node node) Gets the next sibling of a node that is an element. do { node = node.getNextSibling(); } while (node != null && node.getNodeType() != Node.ELEMENT_NODE); return (Element) node; |
Element | getNextSiblingElement(Node node) get Next Sibling Element node = node.getNextSibling(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { return (Element) node; node = node.getNextSibling(); return null; ... |
Element | getNextSiblingElement(Node node) Returns the next sibling element of the specified node. Node sibling = node.getNextSibling(); if ((sibling == null) || (sibling.getNodeType() == Node.ELEMENT_NODE)) { return (Element) sibling; return getNextSiblingElement(sibling); |
Node | getNextSiblingElement(Node node) get Next Sibling Element if (node == null || node.getParentNode() == null) { return null; Node parent = node.getParentNode(); NodeList nodes = parent.getChildNodes(); if (nodes == null) { return null; boolean found = false; for (int i = 0; i < nodes.getLength(); i++) { Node child = nodes.item(i); if (child.equals(node)) { found = true; continue; if (found && child.getNodeType() == Node.ELEMENT_NODE) { return child; return null; |