1 package net.sf.saxon; 2 import net.sf.saxon.event.*; 3 import net.sf.saxon.trans.XPathException; 4 import org.xml.sax.SAXParseException ; 5 6 import javax.xml.transform.Result ; 7 import javax.xml.transform.Source ; 8 import javax.xml.transform.TransformerException ; 9 10 class IdentityTransformer extends Controller { 11 12 protected IdentityTransformer(Configuration config) { 13 super(config); 14 } 15 16 19 20 public void transform(Source source, Result result) 21 throws TransformerException { 22 try { 23 PipelineConfiguration pipe = makePipelineConfiguration(); 24 Receiver receiver = ResultWrapper.getReceiver( 25 result, pipe, getOutputProperties()); 26 NamespaceReducer reducer = new NamespaceReducer(); 27 reducer.setUnderlyingReceiver(receiver); 28 new Sender(pipe).send(source, reducer, true); 29 } catch (XPathException err) { 30 Throwable cause = err.getException(); 31 if (cause != null && cause instanceof SAXParseException ) { 32 SAXParseException spe = (SAXParseException )cause; 37 cause = spe.getException(); 38 if (cause instanceof RuntimeException ) { 39 getErrorListener().fatalError(err); 40 } 41 } else { 42 getErrorListener().fatalError(err); 43 } 44 throw err; 45 } 46 } 47 48 } 49 50 | Popular Tags |