public static <T extends Node> List<T> getChildNodes(Node node, Class<T> nodeClass) {
        List<T> childNodes = new ArrayList<>();
        NodeList childList = node.getChildNodes();
        int length = childList.getLength();
        for (int i = 0; i < length; i++) {
            Node child = childList.item(i);
            if (nodeClass.isInstance(child)) {
                childNodes.add(nodeClass.cast(child));
            }
        }
        return childNodes;
    }