in reply to Re: Inserting new elements in an XML doc using XML::Twig
in thread Inserting new elements in an XML doc using XML::Twig
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inserting new elements in an XML doc using XML::Twig
by Herkum (Parson) on Feb 12, 2007 at 19:05 UTC | |
by mirod (Canon) on Feb 12, 2007 at 19:23 UTC | |
by GrandFather (Saint) on Feb 12, 2007 at 20:09 UTC | |
by Herkum (Parson) on Feb 13, 2007 at 03:38 UTC | |
by Tanktalus (Canon) on Feb 12, 2007 at 20:07 UTC | |
by Withigo (Friar) on Feb 22, 2007 at 02:02 UTC |