in reply to placing an existing line from my XML file to the top of the file
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); } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: placing an existing line from my XML file to the top of the file
by gasjunkie_jabz (Novice) on Aug 20, 2015 at 19:00 UTC |