ByteArrayOutputStream out = new ByteArrayOutputStream();
Pipeline<StAXPipelineComponent> pipe = new NonCachingPipeline<StAXPipelineComponent>();
pipe.addComponent(new XMLGenerator(input));
XMLEventFactory factory = XMLEventFactory.newInstance();
List<Attribute> atts = new ArrayList<Attribute>();
atts.add(factory.createAttribute("attribute", "bad"));
List<Attribute> newAtts = new ArrayList<Attribute>();
newAtts.add(factory.createAttribute("attribute", "good"));
StartElementAttributeModificationTransformer modifier = new StartElementAttributeModificationTransformer(
"anyelement", atts, newAtts);
pipe.addComponent(modifier);
pipe.addComponent(new XMLSerializer());
pipe.setup(out);