我有一些代码:
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)
这会产生以下错误:
Caught: javax.xml.transform.TransformerException: Can’t transform a Source of type javax.xml.transform.stax.StAXSource
reader对象的类型为com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl