Notes on Microsoft ASP.NET, C#, SQL as well as Mac, Unix and Linux and related fixes for StokeMaster.COM and other software development projects... You could be having the same problem as me!
Sunday, July 18, 2010
Creating XMLDocument from Program Embedded String in C#
Problem:
You want to quickly create a simple XML document without needing to write data to a file.
Solution:
Use StringReader class and feed that into the Load() function.
Example Code: XmlDocument doc = new XmlDocument(); doc.Load(new StringReader("<myNode>Hello</myNode>"));
Update: Well, that was doing too much, Load(string) would have worked just as well.
0 comments:
Post a Comment