code: public static List<Element> getAllChildElements(Element parent) {
          List<Element> result;
          NodeList nodes;
          int i;
          int max;
          Node node;
  
          result = new ArrayList<>();
          nodes = parent.getChildNodes();
          max = nodes.getLength();
          for (i = 0; i < max; i++) {
              node = nodes.item(i);
              if (node instanceof Element) {
                  result.add((Element) node);
              }
          }
          return result;
      }
docs: TODO: replace by iterator?