select temp handle; parsefile; restore original handle; rename /backup; #### $twig->infile('file.xml') ->backup('.bak') ->tempout ->parseit ->replaceoriginalwithtemp