Here you can find the source of getFirstChildElement(Node parent)
Parameter | Description |
---|---|
parent | a parameter |
public static Element getFirstChildElement(Node parent)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; public class Main { /**//from w w w . j av a 2 s.co m * Returns a node's first child node that is an element. * @param parent * @return first child element, or null */ public static Element getFirstChildElement(Node parent) { NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node n = children.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { return (Element) n; } } return null; } }