Here you can find the source of getTextFromMultipleSelect(Element doc, String location, String locationValue)
public static String getTextFromMultipleSelect(Element doc, String location, String locationValue)
//package com.java2s; //License from project: Open Source License import org.jsoup.nodes.Element; public class Main { public static String getTextFromMultipleSelect(Element doc, String location, String locationValue) { String[] locations = location.split(","); String[] locationValues = locationValue.split(","); Element currentElement = doc; // Space to store the current element int counter = 0; for (int i = 0; i < (locations.length); i = +2) { // Location will be always a multiple of two if (currentElement == null) { break; } else { currentElement = currentElement .select(locations[i] + "[" + locations[i + 1] + "=" + locationValues[counter] + "]") .first();/*from w ww . j a v a 2 s .c o m*/ counter += 1; } } String result = (currentElement != null) ? currentElement.text() : "none"; return result.trim(); } }