Here you can find the source of getNodeTextValue(Node node)
private static String getNodeTextValue(Node node)
//package com.java2s; /******************************************************************************* * Copyright ? 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/* w w w . j ava 2s . c om*/ * IBM Corporation - initial API and implementation * *******************************************************************************/ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { private static String getNodeTextValue(Node node) { String value = ""; NodeList nodes = node.getChildNodes(); for (int idx = 0; idx < nodes.getLength(); idx++) { node = nodes.item(idx); if (node.getNodeType() == Node.TEXT_NODE) { value = node.getNodeValue(); break; } } return value; } }