Java tutorial
//package com.java2s; import org.w3c.dom.Element; public class Main { /** * Return the child element whose name is as specified. * <p> * Note: it's up to the user to guarantee that there EXISTS and is only * ONE child element. * @param parent * @param name * @return */ public static Element getUniqueElementByTagName(Element parent, String name) { Element elm = (Element) parent.getElementsByTagName(name).item(0); return elm; } }