Code example for TransformerFactory

Methods: getErrorListener, newTransformer

0
   *           If an output error occurred. 
   */ 
  public void process(HttpRecordingDocument result) throws IOException {
 
    try { 
      final Transformer transformer = m_transformerFactory
          .newTransformer(new StreamSource(m_styleSheetInputStream));
 
      // One might expect this to be the default, but it's not. 
      transformer.setErrorListener(m_transformerFactory.getErrorListener());
 
      transformer.transform(new StAXSource(result.newXMLStreamReader()),
                            new StreamResult(m_output));
 
      m_output.println();
    } 
    catch (TransformerException e) {
      // ErrorListener will have logged. 
    } 
    finally { 
      m_styleSheetInputStream.close();