Here you can find the source of getTextWithoutTrim(Element elem)
public static final String getTextWithoutTrim(Element elem)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static final String getTextWithoutTrim(Element elem) { if (elem != null) { NodeList childNodes = elem.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i).getNodeType() == Node.TEXT_NODE) { return childNodes.item(i).getNodeValue(); }/*w w w . j ava2 s.c om*/ } } return null; } }