Here you can find the source of hasChildOfType(final Element e, final String name)
public static boolean hasChildOfType(final Element e, final String name)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static boolean hasChildOfType(final Element e, final String name) { for (Node child = e.getFirstChild(); child != null; child = child .getNextSibling()) {//www. j av a 2 s . com if (child instanceof Element) { if (((Element) child).getTagName().equals(name)) { return true; } } } return false; } }