|We don't bite newbies here... much|
Processing Two XML Files in Parallelby tedv (Pilgrim)
|on Jul 21, 2011 at 21:10 UTC||Need Help??|
tedv has asked for the
wisdom of the Perl Monks concerning the following question:
I'm writing a script that needs to process two XML files in parallel. It needs to take element #1 from file A and element #1 from file B, and output a new element into file C. Then it performs the same operation on element #2, and so on. As a very simple example:
Input file A:
Input file B:
Output file C:
The catch is that the files are very large, so you cannot parse them all into memory at once. And sadly the XML::Parser interface seems to require parsing the entire first file, handling all callbacks, before you can invoke a call to the parsing of the second file.
Now if this was just a simple text file, the code would be pretty simple. It looks something like this:
But because it's XML, everything is more painful. Does anyone know of what might work? Someone suggested XML::Twig, but I'm still reading the documentation to make sure the internal implementation doesn't prohibit this from working.