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 ; }
Provides a list with all the elements in the xml feature descriptor .