code: protected List<Element> filterDescendants(Element parent, String[] tagNames)
      {
          List<Element> result = new ArrayList<Element>();
          for (String tagName : tagNames) {
              NodeList nodes = parent.getElementsByTagName(tagName);
              for (int i = 0; i < nodes.getLength(); i++) {
                  Element element = (Element) nodes.item(i);
                  result.add(element);
              }
          }
          return result;
      }
docs: Utility method for filtering an element's descendants by their tag names.
  
  @param parent the parent {@link Element}.
  @param tagNames an array of tagNames.
  @return list of descendants of the parent element having one of given tag names.