in reply to XML-Twig - AS5.6.1 vs AS 5.8.8
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML-Twig - AS5.6.1 vs AS 5.8.8
by drmikec (Initiate) on Mar 29, 2006 at 21:00 UTC | |
by runrig (Abbot) on Mar 29, 2006 at 22:13 UTC | |
by drmikec (Initiate) on Mar 29, 2006 at 22:39 UTC | |
by runrig (Abbot) on Mar 30, 2006 at 21:37 UTC |