Java HTML Jsoup Element containsLink(Element element, String link)

Here you can find the source of containsLink(Element element, String link)

Description

contains Link

License

Open Source License

Declaration

public static boolean containsLink(Element element, String link) 

Method Source Code

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

import org.jsoup.nodes.Element;

public class Main {
    public static boolean containsLink(Element element, String link) {
        int links = 0;
        for (Element child : element.children()) {
            if (child.tagName().equals("a") && child.hasAttr("href") && child.attr("href").contains(link))
                links++;//  w  w  w  . j  ava2  s.co m
        }
        return links > 0;
    }
}

Related

  1. appendFragment(Element e, String fragment)
  2. appendText(Element element, StringBuffer stringBuffer)
  3. childrenByTag(final Element element, final String tag)
  4. collectItemRewards(final Element icontab, final BiConsumer collector)
  5. collectTextUntilNextTag(final Element header, final String nextTagName)
  6. convertLinksToStrings(Elements links)
  7. convertNodeToText(Element element)
  8. convertTablesToDivs(Element body)
  9. copy(Element e)