I'm assuming that's only part of the file and you may have multiple testsuite elements. I don't understand the example though as I would have expected the testsuite time and counts to be the sum the testcases.
poj#!perl use strict; use XML::Twig; my $t = XML::Twig->new( twig_handlers => { 'testcase' => \&testcase, 'testsuite' => \&testsuite, }, pretty_print => 'indented',); $t->parsefile( 'test.xml' ); $t->print_to_file('new.xml'); $t->print(); my @case=(); sub testcase { my ($t,$e) = @_; push @case,$e->cut; }; sub testsuite { my ($t,$e) = @_; while ($_ = pop @case){ $_->paste($e); } };
In reply to Re: placing an existing line from my XML file to the top of the file
by poj
in thread placing an existing line from my XML file to the top of the file
by gasjunkie_jabz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |