private List<Node> getElementNodes(NodeList nodes) {
    ArrayList<Node> result = new ArrayList<>();
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        result.add(node);
      }
    }

    return result;
  }
Return just the nodes from a nodelist that are of type element.
geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java