Here you can find the source of getTextFromAvailableDivID(Document doc, String divID)
public static String getTextFromAvailableDivID(Document doc, String divID)
//package com.java2s; //License from project: Open Source License import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { public static String getTextFromAvailableDivID(Document doc, String divID) { Elements elementsById = doc.getElementsByClass(divID); if (elementsById.size() > 0) { Element element = elementsById.first(); String result = element.text(); return result; } else {//from ww w .j a v a 2 s .c o m return "none"; } } }