There are a few problems with your code:
The set_text is completely useless (you set the text in the new above, and BTW new XML::Twig::Elt is a deprecated way of calling a method, XML::Twig::Elt->new is the proper way.my $balance30elt = new XML::Twig::Elt('BAL_30', $balance30); $balance30elt->set_text($balance30); $balance30elt->set_att(Period => 1); $balance30elt->paste('first_child', $balance);
And actually it looks like you don't even need to delete then re-create the BAL_30 (and BAL_60) element. You could just do:$balance->insert_new_elt( first_child, # position 'BAL_30', # tag { Period => 1 }, # attributes $balance, # content );
$balance->first_child( 'BAL_30') # get the element ->del_atts # if it had atts originally ->set_att( Period => 1) ;
Does it make sense?
In reply to Re: XML-Twig - AS5.6.1 vs AS 5.8.8
by mirod
in thread XML-Twig - AS5.6.1 vs AS 5.8.8
by drmikec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |