http://qs321.pair.com?node_id=696968


in reply to Seralize a XML tree from XML::Parser

XML::LibXML can serialize XML:
    use XML::LibXML;
    my $parser = XML::LibXML->new();

    my $doc = eval { $parser->parse_file($file) };
    if ($@) {
        print STDERR "Couldn't parse '$file', skipping\n";
    } else {
        my $dom = $doc->documentElement;

        # use DOM methods here

        $doc->toFile($file);
    }