public static Document toDOMDocument(InputStream is,Debug debug){
  DocumentBuilder documentBuilder=null;
  try {
    documentBuilder=getSafeDocumentBuilder(validating);
  }
 catch (  ParserConfigurationException pe) {
    if (debug != null) {
      debug.error("XMLUtils.DocumentBuilder init failed",pe);
    }
  }
  try {
    if (documentBuilder == null) {
      if (debug != null) {
        debug.error("XMLUtils.toDOM : null builder instance");
      }
      return null;
    }
    if (debug != null && debug.warningEnabled()) {
      documentBuilder.setErrorHandler(new ValidationErrorHandler(debug));
    }
    return documentBuilder.parse(is);
  }
 catch (  Exception e) {
    if (debug != null && debug.warningEnabled()) {
      debug.warning("Can't parse the XML document",e);
    }
    return null;
  }
}

public static Document toDOMDocument ( InputStream is , Debug debug ) { DocumentBuilder documentBuilder = null ; try { documentBuilder = getSafeDocumentBuilder ( validating ) ; } catch ( ParserConfigurationException pe ) { if ( debug != null ) { debug . error ( "XMLUtils.DocumentBuilder init failed" , pe ) ; } } try { if ( documentBuilder == null ) { if ( debug != null ) { debug . error ( "XMLUtils.toDOM : null builder instance" ) ; } return null ; } if ( debug != null && debug . warningEnabled ( ) ) { documentBuilder . setErrorHandler ( new ValidationErrorHandler ( debug ) ) ; } return documentBuilder . parse ( is ) ; } catch ( Exception e ) { if ( debug != null && debug . warningEnabled ( ) ) { debug . warning ( "Can't parse the XML document" , e ) ; } return null ; } }
converts the xml document from an input stream to dom document format .
