Here you can find the source of getText(Element config)
public static String getText(Element config)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; public class Main { /**// w w w. j av a2 s . co m * returns the concatenation of all text children within the node. Does not * recurse into subelements. */ public static String getText(Element config) { if (config == null) return new String(""); NodeList children = config.getChildNodes(); Node node; String out = ""; for (int i = 0; i < children.getLength(); i++) { node = children.item(i); if (node instanceof Text) { out += node.getNodeValue(); } } return out; } }