### Question:
XmlUtil { public static String extractTextFromDocument( final Document doc ) { if( doc == null ) { return ""; } final StringBuilder sb = new StringBuilder(); final List< ? > nodes = XPathFactory.instance().compile( ALL_TEXT_NODES ).evaluate( doc ); for( final Object el : nodes ) { if( el instanceof Text ) { sb.append( ( ( Text )el ).getValue() ); } } return sb.toString(); } private  XmlUtil(); static List<Element> parse( final String xml, final String requestedNodes ); static List< Element > parse( final InputStream xmlStream, final String requestedNodes ); static String extractTextFromDocument( final Document doc );  }### Answer:
@Test public void testExtractTestFrom() throws Exception { Assertions.assertEquals( "", XmlUtil.extractTextFromDocument( null ) ); final SAXBuilder builder = new SAXBuilder(); try( final InputStream is = new FileInputStream( new File ("./src/test/resources/ini/classmappings.xml" ) ) ) { final Document doc = builder.build( is ); final String text = XmlUtil.extractTextFromDocument( doc ); Assertions.assertEquals( "\n" + " \n" + " java.util.List\n" + " java.util.ArrayList\n" + " \n", text ); } }