protected void parseXmlInputStream ( DefaultHandler handler , InputStream inputStream ) throws IOException { try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Parsing XML response document with handler: " + handler . getClass ( ) ) ; } BufferedReader breader = new BufferedReader ( new InputStreamReader ( inputStream , Constants . DEFAULT_ENCODING ) ) ; xr . setContentHandler ( handler ) ; xr . setErrorHandler ( handler ) ; xr . parse ( new InputSource ( breader ) ) ; } catch ( IOException e ) { throw e ; } catch ( Throwable t ) { try { inputStream . close ( ) ; } catch ( IOException e ) { if ( log . isErrorEnabled ( ) ) { log . error ( "Unable to close response InputStream up after XML parse failure" , e ) ; } } throw new SdkClientException ( "Failed to parse XML document with handler " + handler . getClass ( ) , t ) ; } }
Parses an XML document from an input stream using a document handler .