NonCachingPipeline<SAXPipelineComponent> pipeSAX = new NonCachingPipeline<SAXPipelineComponent>();
ByteArrayOutputStream outputSAX = new ByteArrayOutputStream();
pipeSAX.addComponent(new org.apache.cocoon.sax.component.XMLGenerator(CleaningTransformerTest.class
.getResource("/org/apache/cocoon/stax/converter/complex-stax-test-document.xml").openStream()));
pipeSAX.addComponent(new CleaningTransformer());
pipeSAX.addComponent(new XMLSerializer());
pipeSAX.setup(outputSAX);
pipeSAX.execute();
String outputSAXString = outputSAX.toString();
outputSAX.close();
// StAX pipeline with SAXCleaningTransformer
InputStream input = CleaningTransformerTest.class.getResource(
"/org/apache/cocoon/stax/converter/complex-stax-test-document.xml").openStream();
ByteArrayOutputStream outputStAX = new ByteArrayOutputStream();
NonCachingPipeline<PipelineComponent> pipeStAX = new NonCachingPipeline<PipelineComponent>();
pipeStAX.addComponent(new XMLGenerator(input));
pipeStAX.addComponent(new StAXToSAXPipelineAdapter());
pipeStAX.addComponent(new CleaningTransformer());
pipeStAX.addComponent(new XMLSerializer());
pipeStAX.setup(outputStAX);
pipeStAX.execute();
input.close();
String outputStAXString = outputStAX.toString();