Hi,
 
I would like to serialize SAX events to a file inside a transformer, so that I can validate the file with the parser. The problem is that I don't how to set the serializer in order to make it able to receive the SAX events which the transformer is receiving from the previous component (a generator or another transformer). Here is a code snippet that shows what I'm trying to do:

public class MyValidationTransformer extends AbstractSAXTransformer {

    XMLSerializer serializer = (XMLSerializer) this.manager.lookup(XMLSerializer.ROLE);

   FileOutputStream fos = new FileOutputStream(/tmp/tmp.xml);

    serializer.setOutputStream(fos);

    /*???

        HOW TO SEND THE SAX EVENTS THE TRANSFORMER IS RECEIVING TO THE SERIALIZER

     *???/

    FileInputStream fis = new FileInputStream(/tmp/tmp.xml); 

    InputSource is = new InputSource(fis);

    Parser parser = (Parser)this.manager.lookup(Parser.ROLE);

    boolean validation = parameters.getParameterAsBoolean("validation", false);

    parser.myParse(this.inputSource, super.xmlConsumer, validation);

}

Oskar

Reply via email to