slugger415 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I've been looking through the Monks site and other resources for answers but haven't come up with anything. (xmltwig.com seems to have disappeared.)
I'm looking for a way to delete an XML tag without deleting its contents. For example, I have this:
<li> <p> Some <b>text</b> </p> </li>
And I want it to be just:
<li> Some <b>text</b> </li>I tried this but I get an error ("cannot paste an element that belongs to a tree"):
if($p->parent('li')){ my(@children) = $p->children; $p->delete; foreach my $c (@children){ $c->paste; } }
Forgive me as I'm a newbie at Twig and am still trying to figure out how it works.
Many thanks, Scott
Back to
Seekers of Perl Wisdom