Java HTML Jsoup Element filterElementsByTag(List results, Element element, Set tagSet)

Here you can find the source of filterElementsByTag(List results, Element element, Set tagSet)

Description

filter Elements By Tag

License

Mozilla Public License

Declaration

private static void filterElementsByTag(List<Element> results, Element element, Set<String> tagSet) 

Method Source Code

//package com.java2s;
/**//w  w w .  j  a  v a 2  s.  c o  m
 * Copyright (C) 2012-2014 Gist Labs, LLC. (http://gistlabs.com)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

import java.util.List;
import java.util.Set;

import org.jsoup.nodes.Element;

public class Main {
    private static void filterElementsByTag(List<Element> results, Element element, Set<String> tagSet) {
        if (tagSet.contains(element.tag().getName().toLowerCase()))
            results.add(element);

        for (Element child : element.children())
            filterElementsByTag(results, child, tagSet);
    }
}

Related

  1. copy(Element e)
  2. countElements(Node parent)
  3. createSafeElement(Element sourceEl)
  4. elementsToList(Elements elements)
  5. extractTextWithNewlines(Element elem)
  6. findAElementsWithId(Elements elements, String id)
  7. findAllNodesBefore(Element firstChapter)
  8. findElementsByTag(Element element, String... tags)
  9. findFirstByTag(Element element, String tag)