http://www.perlmonks.org?node_id=928087


in reply to XML::Twig removing tags from content

I usually use XML::XSH2 for XML manipulation. For a task like yours, I'd use something like
for //li/* mv text() replace . ;
Update: Ouch, this works better:
for //li/* { xmove (text()|*) after . ; rm . ; }
or, even shorter:
for //li/* xmove (text()|*) replace . ;