Here you can find the source of getElementTextBySelector(String html, String selector)
public static String getElementTextBySelector(String html, String selector)
//package com.java2s; //License from project: Apache License import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class Main { public static String getElementTextBySelector(String html, String selector) { Document document = Jsoup.parse(html); Elements e = document.select(selector); if (e == null || e.isEmpty()) { return null; }/*from w w w.ja va2 s.c om*/ return Jsoup.parse(e.toString()).text(); } }