Here you can find the source of getFirstValidNode(Node node)
public static Node getFirstValidNode(Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getFirstValidNode(Node node) { NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (isValidNode(children.item(i))) return children.item(i); }/*from w w w. j a va 2s . com*/ return null; } public static boolean isValidNode(Node node) { return !node.getNodeName().equals("#text"); } public static boolean isValidNode(Node node, String name) { return node.getNodeName().equals(name); } }