When you use the DOM parser, it reads from the XML file and creates data structures (the DOM) in your computer's memory. When you delete the node from the DOM, that doesn't have any effect on the file you parsed from, it only affects the data in memory.
If you want the original file to be changed as well, then after you make your changes to the DOM you have to write the DOM out to that file. The Ranch has an FAQ page called Document To File (follow that link) which explains just how to do that.
posted 3 years ago
Thank you very much for your help.
The correct code is