CSharp examples for System.Xml:XML String
Get Xml String from file
using System.Xml; using System.Text; using System.Linq; using System.IO;/*from w ww .j a va 2 s .c om*/ using System.Collections.Generic; using System; public class Main{ public static string GetXmlString(string strFile) { // Load the xml file into XmlDocument object. XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(strFile); } catch (XmlException e) { Console.WriteLine(e.Message); } // Now create StringWriter object to get data from xml document. StringWriter sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); xmlDoc.WriteTo(xw); return sw.ToString(); } }