Java HTML Jsoup Element getOneSubItemOfClass(Element parent, String className)

Here you can find the source of getOneSubItemOfClass(Element parent, String className)

Description

get One Sub Item Of Class

License

Apache License

Declaration

public static Element getOneSubItemOfClass(Element parent, String className) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class Main {
    public static Element getOneSubItemOfClass(Element parent, String className) {
        return getOneSubItemOfClass(parent, "div", className);

    }/*from ww w.  jav a  2s . c  o  m*/

    public static Element getOneSubItemOfClass(Element parent, String tag, String className) {
        Elements select = parent.select(tag + "[class*=" + className + "]");
        if (select.size() != 1)
            throw new IllegalStateException("not one item of class " + className);
        return select.first();

    }
}

Related

  1. getIndustry(Element element)
  2. getInt(Elements td, int i)
  3. getLink(Element element, int index)
  4. getMoney(final Element container)
  5. getNameFromAttributes(org.jsoup.nodes.Element e)
  6. getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue)
  7. getSingleElement(final Elements elements)
  8. getSrcOrRelFromImageElement(Element imgElm)
  9. getString(Elements td, int i)