Java examples for XML:XML Element Child
does XML Element Contain Children
//package com.java2s; import org.w3c.dom.Element; public class Main { public static boolean doesElementContainChildren(Element parent, String... childNames) { boolean missingChild = false; for (String childName : childNames) { if (parent.getElementsByTagName(childName).getLength() == 0) { missingChild = true;//from www . jav a 2 s.c o m } } if (missingChild) return false; else return true; } }