http://www.perlmonks.org?node_id=28399


in reply to Replacing XML content

Sounds like a job for DOM (XML::DOM) style of parsing rather than SAX model which XML::Parser and XML::Twig use. Basically have in memory trees for both trees, then iterate through the new tree nodes and replace node in first with the new one and finally dumping it out.