Java tutorial
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getChildNodeTextContent(Node parentNode, String childElementName) { Node node = getChildNode(parentNode, childElementName); if (node != null) return node.getTextContent(); return null; } public static Node getChildNode(Node parentNode, String childElementName) { NodeList l = parentNode.getChildNodes(); for (int i = 0; i < l.getLength(); i++) { Node node = l.item(i); if (node.getNodeName().equals(childElementName)) return node; } return null; } }