code: protected List<Element> filterChildren(Element parent, String tagName)
      {
          List<Element> result = new ArrayList<Element>();
          Node current = parent.getFirstChild();
          while (current != null) {
              if (current.getNodeName().equals(tagName)) {
                  result.add((Element) current);
              }
              current = current.getNextSibling();
          }
          return result;
      }
docs: Utility method for filtering an element's children with a tagName.
  
  @param parent the parent {@link Element}.
  @param tagName expected tagName of the children elements.
  @return list of children elements with the provided tagName.