Here you can find the source of hasChildElement(Element elem, String namespace, String localName)
Parameter | Description |
---|---|
elem | A DOM Element. |
namespace | A namespace name (absolute URI). |
localName | A String representing the local name of an element. |
public static boolean hasChildElement(Element elem, String namespace, String localName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; public class Main { /**// w w w .j a v a 2s . co m * Checks if a DOM Element has a child element with the given qualified * name. * * @param elem * A DOM Element. * @param namespace * A namespace name (absolute URI). * @param localName * A String representing the local name of an element. * * @return {@code true} if one or more matching child elements are present; * {@code false} otherwise. */ public static boolean hasChildElement(Element elem, String namespace, String localName) { return elem.getElementsByTagNameNS(namespace, localName).getLength() > 0; } }