code: public static List<Element> getDescriptorElements(InputStream xmlDescriptorIn)
        throws IOException {
  
      List<Element> elements = new ArrayList<>();
      org.w3c.dom.Document xmlDescriptorDOM = createDOM(xmlDescriptorIn);
      XPath xPath = XPathFactory.newInstance().newXPath();
      NodeList allElements;
      try {
        XPathExpression exp = xPath.compile("//*");
        allElements = (NodeList) exp.evaluate(xmlDescriptorDOM.getDocumentElement(), XPathConstants.NODESET);
      } catch (XPathExpressionException e) {
        throw new IllegalStateException("The hard coded XPath expression should always be valid!");
      }
  
      for (int i = 0; i < allElements.getLength(); i++) {
        if (allElements.item(i) instanceof Element) {
          Element customElement = (Element) allElements.item(i);
          elements.add(customElement);
        }
      }
      return elements;
    }
docs: Provides a list with all the elements in the xml feature descriptor.
  @param xmlDescriptorIn the xml feature descriptor
  @return a list containing all elements
  @throws IOException if inputstream cannot be open
  @throws InvalidFormatException if xml is not well-formed