Android examples for XML:XML Element
get First XML Element
/*/*from w ww . j a va2s.co m*/ * XmlUtil.java * * (c) 2009 The Echo Nest * See "license.txt" for terms * * */ //package com.java2s; import java.io.IOException; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element getFirstElement(Element element, String elementName) throws IOException { NodeList list = element.getElementsByTagName(elementName); if (list.getLength() >= 1) { Element subElement = (Element) list.item(0); return subElement; } else { return null; } } }