@Override
    public void endElement(String uri, String local, String name) {
        if (!builderStack.isEmpty() && XHTML.equals(uri)) {
            if ("a".equals(local) || "img".equals(local) || "link".equals(local) ||
                    "script".equals(local) || "iframe".equals(local)) {
                // ensure this is the correct builder. not all </script> tags correspond
                // to a LinkBuilder, e.g. for embedded scripts
                if (builderStack.getFirst().getType().equals(local)) {
                    LinkBuilder builder = builderStack.removeFirst();
                    links.add(builder.getLink(collapseWhitespaceInAnchor));
                }
            }
        }
    }
Returns the list of collected links.

@return collected links
tika-core/src/main/java/org/apache/tika/sax/LinkContentHandler.java