Code example for XMLFilter

Methods: setParent

            // Wire the output of the reader to filter1 
            // and the output of filter1 to filter2 
            // --A filter is a kind of reader 
            // --Setting the parent sets the input reader 
            // --Since a filter is a reader, the "parent" could be another filter 
            // Set up the output stream 
            StreamResult result = new StreamResult(System.out);
            // Set up the transformer to process the SAX events generated 
            // by the last filter in the chain 
            Transformer transformer = stf.newTransformer();
            SAXSource transformSource = new SAXSource(filter2, input);
            transformer.transform(transformSource, result);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser 
            System.out.println("\n** Transformer Factory error");
            System.out.println("   " + tce.getMessage());