Java HTML Jsoup Element getSingleElement(final Elements elements)

Here you can find the source of getSingleElement(final Elements elements)

Description

get Single Element

License

Open Source License

Declaration

public static Element getSingleElement(final Elements elements) 

Method Source Code


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

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

public class Main {
    public static Element getSingleElement(final Elements elements) {
        if (elements.size() != 1) {
            throw new IllegalArgumentException(
                    "A single element matching the criteria was expected.  Instead, found " + elements.size());
        }/*from  w  w w  . j  av  a2  s.  com*/

        return elements.first();
    }
}

Related

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