Java HTML Jsoup Element getLink(Element element, int index)

Here you can find the source of getLink(Element element, int index)

Description

get Link

License

Open Source License

Declaration

public static String getLink(Element element, int index) 

Method Source Code

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

import org.jsoup.nodes.Element;

import java.util.List;

public class Main {
    public static String getLink(Element element, int index) {
        try {//from   w ww. j  a  va  2s .com
            List<Element> elements = element.getElementsByTag("a");
            return elements.get(index).attr("href");
        } catch (IndexOutOfBoundsException e) {
            throw new NullPointerException();
        }
    }
}

Related

  1. getElIndexInSameTags(Element e)
  2. getFirstWithOwnText(final Elements elementList, final String text)
  3. getFormattedText(Element element)
  4. getIndustry(Element element)
  5. getInt(Elements td, int i)
  6. getMoney(final Element container)
  7. getNameFromAttributes(org.jsoup.nodes.Element e)
  8. getOneSubItemOfClass(Element parent, String className)
  9. getReviewAuthorIDFromMultipleSelect(Element doc, String location, String locationValue)