Here you can find the source of getFirstChildTextNodeValue(Node node)
null
if not found.
public static String getFirstChildTextNodeValue(Node node)
//package com.java2s; /**//w w w. j a v a2 s . co m * This file is part of SIMPL4(http://simpl4.org). * * Copyright [2014] [Manfred Sattler] <manfred@ms123.org> * * SIMPL4 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SIMPL4 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SIMPL4. If not, see <http://www.gnu.org/licenses/>. */ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** * Returns value of first available child text node or <code>null</code> if not found. */ public static String getFirstChildTextNodeValue(Node node) { NodeList children = node.getChildNodes(); int len = children.getLength(); for (int i = 0; i < len; i++) { Node n = children.item(i); if (n.getNodeType() == Node.TEXT_NODE) { return n.getNodeValue(); } } return null; } }