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();
    }
  }
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();
    }
  }
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.
@param reader The reader to parse
@return The parsed XML document
Parse the content of a given reader into an XML document .