Here you can find the source of isChildOf(Element child, Elements possibleParents)
Parameter | Description |
---|---|
child | the child element |
possibleParents | the possible parents |
public static boolean isChildOf(Element child, Elements possibleParents)
//package com.java2s; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { /**/*from w w w. java 2 s .c o m*/ * Determines whether the given element is a child of one of the given * parent elements. * @param child the child element * @param possibleParents the possible parents * @return true if it is a child, false if not */ public static boolean isChildOf(Element child, Elements possibleParents) { for (Element parent : child.parents()) { if (possibleParents.contains(parent)) { return true; } } return false; } }