code: public static Document parseXmlStream(final Reader xmlStream) {
  
          // Build a DOM model of the provided xmlFileStream.
          final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);
  
          try {
              return factory.newDocumentBuilder().parse(new InputSource(xmlStream));
          } catch (Exception e) {
              throw new IllegalArgumentException("Could not acquire DOM Document", e);
          }
      }
docs: Parses the provided InputStream to create a dom Document.
  
  @param xmlStream An InputStream connected to an XML document.
  @return A DOM Document created from the contents of the provided stream.