public static Document parse ( File file ) { if ( ! file . isFile ( ) ) { throw new IllegalArgumentException ( "Missing file: " + file . getAbsolutePath ( ) ) ; } try { try ( InputStream stream = Files . newInputStream ( file . toPath ( ) , StandardOpenOption . READ ) ) { return parse ( stream ) ; } } catch ( IOException e ) { throw new IllegalArgumentException ( "Failed to parse " + file . getAbsolutePath ( ) , e ) ; } }
Parse the content of a given file into an XML document .