code: public Document build(XMLStreamReader r) throws ParserConfigurationException, XMLStreamException {
          return build(r, DocumentBuilderFactory.newInstance().newDocumentBuilder());
      }
docs: This method will create a {@link org.w3c.dom.Document} instance using the default JAXP mechanism and populate using the given StAX stream reader.
  
  @param r
  Stream reader from which input is read.
  @return <code>Document</code> - DOM document object.
  @throws ParserConfigurationException
  if parse is not configured
  @throws XMLStreamException
  If the reader threw such exception (to indicate a parsing or I/O problem)