Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { /** * Getter for a specific text content of the given node. * @param node Node. * @param name Name of element tags around the text content. * @return Returns the content or null if no content with the given * name exists. */ static public String getTextContent(Node node, String name) { node = node.getFirstChild(); while (node != null) { if (node.getNodeName().equals(name)) return (node.getTextContent()); node = node.getNextSibling(); } return (null); } }