using System; using System.IO; using System.Xml; class MainClass { static void Main(string[] args) { StringReader stream = new StringReader("Sample.xml"); XmlTextReader reader = new XmlTextReader(stream); while (reader.Read()) { //TODO - } if (reader != null) reader.Close(); } }