// xmlFilter3 outputs SAX events to the serializer.
Serializer serializer = SerializerFactory.getSerializer
(OutputProperties.getDefaultMethodProperties("xml"));
serializer.setOutputStream(System.out);
xmlFilter3.setContentHandler(serializer.asContentHandler());
// Perform the series of transformations as follows:
// - transformer3 gets its parent (transformer2) as the XMLReader/XMLFilter
// and calls transformer2.parse(new InputSource("foo.xml")).
// - transformer2 gets its parent (transformer1) as the XMLReader/XMLFilter