Function to search recursively root node from dom.