Java examples for XML:XML Element Child
get XML Element Child As String
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static String getChildAsString(Element e, String child) { NodeList nodes = e.getElementsByTagName(child); if (nodes.getLength() > 0) { Element i = (Element) nodes.item(0); return i.getTextContent().trim(); } else// w w w.j a va2 s . com return null; } }