Java HTML Jsoup Element getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue)

Here you can find the source of getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue)

Description

get Review Author ID From Multiple Select

License

Open Source License

Declaration

public static String getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.jsoup.nodes.Element;

public class Main {
    public static String getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue) {
        String author_id = getAttributeFromMultipleSelect(doc, location, locationValue);
        if (!author_id.equals("none")) {
            author_id = (author_id != null) ? (author_id.split("=")[1]) : "none";
        }/*from w  w  w .j av  a2  s .c om*/
        return author_id.trim();
    }

    public static String getAttributeFromMultipleSelect(Element doc, String location, String locationValue) {
        String[] locations = location.split(",");
        String[] locationValues = locationValue.split(",");
        Element element = doc.select(locations[0] + "[" + locations[1] + "=" + locationValues[0] + "]").first();
        element = element.select(locations[2] + "[" + locations[3] + "]").first();
        String result = (element != null) ? element.attr(locations[3]) : "none";
        return result.trim();
    }
}

Related

  1. getInt(Elements td, int i)
  2. getLink(Element element, int index)
  3. getMoney(final Element container)
  4. getNameFromAttributes(org.jsoup.nodes.Element e)
  5. getOneSubItemOfClass(Element parent, String className)
  6. getSingleElement(final Elements elements)
  7. getSrcOrRelFromImageElement(Element imgElm)
  8. getString(Elements td, int i)
  9. getTextContent(Element node)