Hello esteemed monks, I'm learning XML::Twig and have not been able to figure out how to insert an element in a particular location other that first_child or last_child. For example, here is my XML source:
<concept> <title>My Title</title> <prolog>some other info</prolog> </concept>
I want to insert a new element "short_desc" in between "title" and "prolog". How do I do that?
I can do this using first_child and last_child thusly:
my($twig,$con) = @_; $con->insert_new_elt('first_child','short_desc' =>{ AAA => 'hello'});
which results in
<short_desc AAA="hello"/> <title>Bat sonar</title> <prolog>some other info</prolog>
but what I want is:
<title>Bat sonar</title> <short_desc AAA="hello"/> <prolog>some other info</prolog>
Any pointers appreciated. I have been scanning the Twig doc but am not sure what to look for. I see mention of $opt_position but this is not defined anywhere. (The xml twig site seems to have been dead for a while...)
Thank you -- Scott
In reply to XML::Twig inserting a new element, not first or last by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |