Use parse instead of parsefile, and pass it an IO handle. Filter the data before it gets to the parser. There are several ways to do that. You could write a separate program and pipe the output to this one (and pass the parser STDIN),
fork a child process which reads/filters/outputs the file and the parent process reads from it (easy with
pipe), or create a tied filehandle which filters input (which may work if XML::Parser will accept a tied filehandle).