save primary.xml to disk instead of string variable