List of utility methods to do XML Node Parent
Element | getParent(Element elem) get Parent Node parent = elem.getParentNode(); if (parent instanceof Element) return (Element) parent; return null; |
Node | getParent(final Node n) get Parent return n instanceof Attr ? ((Attr) n).getOwnerElement() : n.getParentNode(); |
Node | getParent(Node node) Gets parent node of the given node return (node.getNodeType() == Node.ATTRIBUTE_NODE) ? ((Attr) node).getOwnerElement() : node.getParentNode();
|
Element | getParent(Node target) get Parent Node parent = target.getParentNode(); while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) return (Element) parent; parent = parent.getParentNode(); return null; |
Element | getParentElement(Element element) Gets the parent element. if (element == null) { return null; Element parentElement = null; Node parentNode = element.getParentNode(); while (parentNode != null && parentElement == null) { if (parentNode.getNodeType() == Node.ELEMENT_NODE) { parentElement = (Element) parentNode; ... |
Element | getParentElement(Element element) Get parent element of specified element Node parent = element.getParentNode(); while (parent != null) { if (parent instanceof Element) return (Element) parent; parent = parent.getParentNode(); return null; |
Element | getParentElement(final Node node) get Parent Element final Node parent = node.getParentNode(); return parent instanceof Element ? (Element) parent : null; |
Element | getParentElement(Node node) Gets parent element or null if there is none. Node parent = node.getParentNode(); return (parent instanceof Element ? (Element) parent : null); |
Element | getParentElement(Node node) get Parent Element Node parent = node.getParentNode(); if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE) { return null; } else { return (Element) parent; |
Element | getParentElement(Node node) Gets parent element or null if there is none Node parent = node.getParentNode(); return (parent instanceof Element ? (Element) parent : null); |