in reply to Re^2: splitting large xml documents
in thread splitting large xml documents

Am I on the write track with this? It seems to work ok.

Many thanks...

my $t = XML::Twig->new(); $t->parsefile( $Globals::input_xml_dir."TimesheetLoad_1.xml" ); my $rt = $t->root; # NikuDataBus my $hd = $rt->first_child( 'Header' ); my $tp = $rt->first_child( 'Customers' ); $tp->cut; my @tp1 = $tp->children( 'Customer' ); my $count = 0; foreach my $tp1 (@tp1) { $tp1->cut; $tp1->paste( after => $hd, $rt ); my $out; open ($out, ">$Globals::input_xml_dir\\twigs\\CustomerLoad_$cou +nt.xml"); $rt->print( $out ); close $out; $tp1->cut; $count++; }

Replies are listed 'Best First'.
Re^4: splitting large xml documents
by Anonymous Monk on Sep 06, 2005 at 11:53 UTC
    Doh!

    It misses out the Customers element.