In C#, what is the best method to format a string as XML?

前端 未结 10 1083
感动是毒
感动是毒 2021-01-01 08:32

I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there\'s a pub

10条回答
  •  一生所求
    2021-01-01 09:11

    Is the string valid XML? Do you mean how can you convert an XML string into an XML document? If so, do this:

    XmlDocument xml = new XmlDocument();
    
    xml.LoadXml( YourString );
    

提交回复
热议问题