Here you can find the source of hasChildElement(NodeList list)
Parameter | Description |
---|---|
list | The NodeList to check. |
public static boolean hasChildElement(NodeList list)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**//from w w w. j a v a2 s. c om * Checks if the given {@link NodeList} contains a child element. * * @param list The {@link NodeList} to check. * @return Whether the {@link NodeList} contains children. */ public static boolean hasChildElement(NodeList list) { Node n; for (int i = 0; i < list.getLength(); i++) { n = list.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { return true; } } return false; } }