Almost right. What I actually was after is:
push @newElts, XML::Twig::Elt->new( keyword => $_ ) for @keywords;
mumble, mumble, exactly right actually, mumble,mumble. Err, that is, yes you are exactly right. Thank you. :)
which generates (when used in the original code):
<?xml version="1.0" encoding="UTF-8"?> <topic> <keywords> <keyword translate="true">this</keyword> <keyword translate="true">that</keyword> <keyword translate="true">the</keyword> <keyword translate="true">other</keyword> </keywords> <body></body> </topic>
I read that documentation forwards and backwards several times, looked at the samples following it, and just couldn't see what was wanted. Doh!
Update: retract silly "almost right" statement. Forgot I needed the attribute!
In reply to Re^2: Inserting new elements in an XML doc using XML::Twig
by GrandFather
in thread Inserting new elements in an XML doc using XML::Twig
by GrandFather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |