I have to search for specific element in DOM Structure recursively, but right now I am completely "stuck" and cannot find where my algorithm is mistaken.
Alg searches for element table and has to return true if it is exists.
private boolean isCompositeExists(Node fieldNode) {
NodeList childNodes = fieldNode.getChildNodes();
if (childNodes != null) {
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
isCompositeExists(child);
if (child.getNodeName().equals("table")) {
return true;
}
}
}
return false;
}