Here you can find the source of getFirstElementChild(Node root)
Parameter | Description |
---|---|
root | a parameter |
public static Element getFirstElementChild(Node root)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /**//from ww w . j av a 2 s .c om * @param root * @return */ public static Element getFirstElementChild(Node root) { Node node = root.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { return (Element) node; } node = node.getNextSibling(); } return null; } }