Updated code to save XML data to file system