#!/usr/bin/perl -w
# use strict;
use warnings;
use XML::Twig;
my $input = XML::Twig->new( twig_roots => { Questions => \&comments },
);
$input->parsefile( 'input.xml');
my $cde = XML::Twig->new( twig_roots => { QQ_Manifest => \&questions },
twig_print_outside_roots => 1,
keep_spaces => 1,
);
$cde->parsefile( 'cde.xml');
$cde->flush;
sub questions {
my( $cde, $questions) = @_;
my $question = $questions->first_child( 'Questions');
foreach ( @comments ) {
$_->paste( last_child => $question);
}
}
sub comments {
my( $input, $comments) = @_;
my $comment = $comments->first_child( 'Comments');
push @comments, $comment;
}
####
####
.....
....