Here you can find the source of findElementOrContainer(Document document, Element parent, String element)
public static Element findElementOrContainer(Document document, Element parent, String element)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element findElementOrContainer(Document document, Element parent, String element) { NodeList nl = parent.getElementsByTagName(element); if (nl.getLength() == 0) { return null; }/*w ww. ja v a2 s . c o m*/ return (Element) nl.item(0); } }