Replace xml


I have a problem. I have an xml loaded in the var xml1. I want to replace all data in it with a newly loaded xml named xml2. I was hoping that I could do it like this: xml1 = xml2.
It doesent work. Can I do it in some other way?