Java tutorial
//package com.java2s; /* * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getChildElementByTagName(Element parentElement, String childTag) { for (Node temp = parentElement.getFirstChild(); temp != null; temp = temp.getNextSibling()) if (temp.getNodeType() == Node.ELEMENT_NODE && childTag.equals(temp.getNodeName())) { return (Element) temp; } return null; } }