Java HTML Jsoup Element getAllNodes(Element element)

Here you can find the source of getAllNodes(Element element)

Description

get All Nodes

License

Open Source License

Declaration

public static List<Node> getAllNodes(Element element) 

Method Source Code


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

import java.lang.reflect.Field;

import java.util.List;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;

public class Main {
    public static List<Node> getAllNodes(Element element) {
        try {//from w w  w. j ava  2s . c o  m
            Field childNodesField = Node.class.getDeclaredField("childNodes");
            childNodesField.setAccessible(true);
            @SuppressWarnings("unchecked")
            List<Node> childNodes = (List<Node>) childNodesField.get(element);
            return childNodes;
        } catch (Exception e) {
            throw new RuntimeException("Could not get the nodes of element: " + element, e);
        }
    }
}

Related

  1. findPreviousH2Element(Element h3)
  2. findPreviousHElement(Elements sequence, Element reference)
  3. findRootElement(Element element)
  4. firstElement(final Element element, final String... tags)
  5. getActiveJob(Element element)
  6. getAuthorName(Element authorElement)
  7. getCodeSnippetCLT(Element codeElement, String content, String fqn, String api, String kind, String[] titles)
  8. getDate(Elements caption)
  9. getDouble(Elements line, int idx)