// MyDotNet\myCSharp\XML\ReadXML.cs // Author: Mesbah U. Ahmed using System; using System.Data; using System.Data.SQL; using System.IO; // using System.ComponentModel; public class ReadXML { public static void Main() { // Get a DataSet object DataSet myDs = new DataSet(); // Get a FileStream object. FileStream myFs = new FileStream ("myXmlData.xml",FileMode.Open,FileAccess.Read); // Apply the ReadXml(fileSteeam method) to read the file myDs.ReadXml(myFs); // Get a DataTable object from the first table of the DataSet DataTable myDt = myDs.Tables[0]; // Display the values for each row foreach (DataRow r in myDt.Rows) Console.WriteLine("{0} : {1} : ${2:f2}", r["ProductId"], r["ProductName"], Double.Parse(r["UnitPrice"].ToString())); myFs.Close(); } }