Convert String to XML - .NET/C#

XAML Designer Jan 03 2010
This tip shows how to convert a string to XML file using C# and .NET.
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 71.7k
  • 0
If you have a valid string in "str", you can use XmlDocument to load the string and then save string to an XML file using Save method of XmlDocument. Don't forget to import System.Xml namespace before using XmlDocument.

XmlDocument doc = new XmlDocument();