use warnings; use strict; use XML::Twig; my $str = <<EOF; <li> <p> Some <b>text</b> </p> </li> EOF my $t = XML::Twig->new( twig_handlers => {li => \&li}, pretty_print => 'indented', ); $t->parse($str); $t->print(); sub li { my ($t, $elt) = @_; for my $p ($elt->children('p')) { for my $c ($p->cut_children()) { $c->paste($elt); } $p->delete(); } } __END__ <li><b>text</b> Some </li>
In reply to Re: XML::Twig removing tags from content (XML::Twig)
by toolic
in thread XML::Twig removing tags from content
by slugger415
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |