Here you can find the source of getTextFromNodeIfAvailable(Element doc)
public static String getTextFromNodeIfAvailable(Element doc)
//package com.java2s; //License from project: Open Source License import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; public class Main { public static String getTextFromNodeIfAvailable(Element doc) { StringBuffer result = new StringBuffer(); for (Node child : doc.childNodes()) { if (child instanceof TextNode) { result.append(((TextNode) child).text()); }//from w w w . j a va 2 s .co m } return result.toString(); } }