gen XML and save to file