public static Document loadDocument(InputStream stream) throws Exception {
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  DocumentBuilder builder=factory.newDocumentBuilder();
  return builder.parse(stream);
}

public static Document loadDocument ( InputStream stream ) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( stream ) ; }
loads a xml document from a stream and returns the corresponding dom document .
