Here you can find the source of firstChildOfType(Node x, String s)
public static Element firstChildOfType(Node x, String s)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element firstChildOfType(Node x, String s) { if (x != null) { Node n = x.getFirstChild(); Node last = x.getLastChild(); while (n != null) { if (n.getNodeName().equals(s)) { return (Element) n; }/*from w w w. j a v a2 s .com*/ if (n == last) break; // DSM handle possible bug in getNextSibling() n = n.getNextSibling(); } } return null; } }