in reply to XML:twig XML wrong

You can also use XML::XSH2's stream command that doesn't load the whole document into memory.
stream :f input.xml :F output.xml select (dobs | dob) { rm ../* ; }

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]