Just to clarify, you're using XMLOut wrong. XMLOut takes a data structure and turns it into XML (a string). From the docs:
in reply to Yet another xml::simple question
The default behaviour of XMLout() is to return the XML as a string. If you wish to write the XML to a file, simply supply the filename using the 'OutputFile' option.
So with the options you're using to XMLOut, you are telling it to write the XML file right away. But then after that, you're trying to mess with the data structure. What you need to do is build up your data structure first (including the time stamp there) and only then call XMLOut.