Here you can find the source of getFirstChildByType(Element element, int nodeType)
public static Node getFirstChildByType(Element element, int nodeType)
//package com.java2s; // License as published by the Free Software Foundation; either import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getFirstChildByType(Element element, int nodeType) { NodeList children = element.getChildNodes(); int childCount = children.getLength(); for (int i = 0; i < childCount; i++) { Node child = children.item(i); if (child.getNodeType() == nodeType) { return child; }//ww w . ja v a 2 s . c o m } return null; } }