Here you can find the source of getAllNodes(Element element)
public static List<Node> getAllNodes(Element element)
//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); } } }