in reply to xml::child add child and descendants

You can insert new children in any part of the Tree but not using handlers. Since the new child you already inserted will not be parsed.

A good technique is to create a new node with the XML you want to insert.

my $xml = <<__XML__; <whatever> ... </whatever> __XML__ my $twig2 = XML::Twig->new(); $twig2->parse($xml); my $elt2 = $twig2->root; $elt->insert_new_elt('first_child', 'foobar', $elt2);