Mega Code Archive

 
Categories / C# / XML
 

LoadXml

using System; using System.IO; using System.Xml; public class BookListing {     public static void Main() {         XmlDocument doc = new XmlDocument();         String entry = "<book genre='biography'" +          " ISBN='1111111111'><title>my title</title>" +          "</book>";         doc.LoadXml(entry);         StringWriter writer = new StringWriter();         doc.Save(writer); // to StringWriter         String strXML = writer.ToString(); // to String         Console.WriteLine(strXML);     } }