LinksSelector extends BaseElementSelector { @Override public List<String> selectList(Element element) { Elements elements = element.select("a"); List<String> links = new ArrayList<String>(elements.size()); for (Element element0 : elements) { if (!StringUtil.isBlank(element0.baseUri())) { links.add(element0.attr("abs:href")); } else { links.add(element0.attr("href")); } } return links; }  @Override String select(Element element); @Override List<String> selectList(Element element); @Override Element selectElement(Element element); @Override List<Element> selectElements(Element element); @Override boolean hasAttribute();  }
@Test public void testLinks() throws Exception { LinksSelector linksSelector = new LinksSelector(); List<String> links = linksSelector.selectList(html); System.out.println(links); html = "<div><a href='aaa'></a></div><div><a href='http: links = linksSelector.selectList(Jsoup.parse(html, "http: System.out.println(links); }