List of utility methods to do XML First Child Element
Element | getFirstChildElement(Node node) Get the first child Element of the supplied node. NodeList children = node.getChildNodes(); int childCount = children.getLength(); for (int i = 0; i < childCount; i++) { Node child = children.item(i); if (child != null && child.getNodeType() == Node.ELEMENT_NODE) { return (Element) child; return null; |
Element | getFirstChildElement(Node node) get First Child Element Node child = node.getFirstChild(); while (child != null && child.getNodeType() != Node.ELEMENT_NODE) { child = child.getNextSibling(); return (Element) child; |
Element | getFirstChildElement(Node node) Returns the first child element of the specified node, or null if there is no such element. Node child = node.getFirstChild(); while (child != null && child.getNodeType() != Node.ELEMENT_NODE) { child = child.getNextSibling(); return (Element) child; |
Element | getFirstChildElement(Node node) Returns the first child Element of a given Node. Node child = node.getFirstChild(); while ((child != null) && (child.getNodeType() != Node.ELEMENT_NODE)) { child = child.getNextSibling(); return (Element) child; |
Element | getFirstChildElement(Node node) Returns the First child element or null if none found if (node == null) { return null; Node child = node.getFirstChild(); if (child instanceof Element) { return (Element) child; } else { return getNextElement(child); ... |
Node | getFirstChildElement(Node node) Get a first XML element of a given node. if (node == null) return null; Node child = node.getFirstChild(); if (child == null) return null; if (child.getNodeType() == Node.ELEMENT_NODE) return child; while (child != null) { ... |
Element | getFirstChildElement(Node node) Get the first child node that is an element node. NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.item(i).getNodeType() == Node.ELEMENT_NODE) { return (Element) children.item(i); return null; |
Element | getFirstChildElement(Node node) get First Child Element return getNthChildElement(node, 0);
|
Element | getFirstChildElement(Node node, String tag) Return the first child element under node that has given given tag name. NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node temp = list.item(i); if (temp.getNodeType() != Node.ELEMENT_NODE) continue; Element tempElement = (Element) temp; if (tempElement.getTagName().equals(tag)) return tempElement; ... |
Element | getFirstChildElement(Node parent) Finds and returns the first child element node. Node child = parent.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { return (Element) child; child = child.getNextSibling(); return null; ... |