title: Transforming a StAX Source in Java
body: <p>I have some code like:</p>
  
  <pre><code>XMLInputFactory xif = XMLInputFactory.newInstance()
  TransformerFactory tf = TransformerFactory.newInstance("org.apache.xalan.processor.TransformerFactoryImpl", null)
  
  Transformer t = tf.newTransformer()
  DOMResult result = new DOMResult()
  t.transform(new StAXSource(reader), result)
  </code></pre>
  
  <p>Which produces the following error:</p>
  
  <blockquote>
    <p>Caught: javax.xml.transform.TransformerException: Can't transform a Source of type javax.xml.transform.stax.StAXSource</p>
  </blockquote>
  
  <p>The reader object is of type <code>com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl</code></p>