public static Document parse ( Reader reader ) { DocumentBuilder documentBuilder = getDocumentBuilder ( ) ; try { return documentBuilder . parse ( new InputSource ( reader ) ) ; } catch ( SAXException | IOException e ) { throw new IllegalArgumentException ( "Failed to parse XML document" , e ) ; } finally { documentBuilder . reset ( ) ; } }
Parse the content of a given reader into an XML document .