The fact that it's XML is basically irrelevant. You can save any text to a file very simply with File.WriteAllText
:
File.WriteAllText("foo.xml", xml);
Note that you can also specify the encoding, which defaults to UTF-8. So for example, if you want to write a file in plain ASCII:
File.WriteAllText("foo.xml", xml, Encoding.ASCII);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…