Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { public static Element getElementByTagName(Document document, String element) { NodeList nodeList = document.getElementsByTagName(element); if (nodeList.getLength() > 0) { return (Element) nodeList.item(0); } else { return null; } } }