void (Element root, List<? super Element> list, List<String> toCheck) { if (toCheck.contains(StringUtil.toLowerCase(root.getName()))) { list.add(root); } for (int i = 0; i < root.getElementCount(); i++) { getAllElements(root.getElement(i), list, toCheck); } }