Java examples for XML:XML Element Child
get First Child By XML Tag Name
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getFirstChildByTagName(Node parent, String tagName) { NodeList nodeList = parent.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equalsIgnoreCase(tagName)) return node; }/*w ww . ja v a2s . c om*/ return null; } }