Thursday, December 4, 2008

Reading XML FIle In Asp.Net

//Here I am giving function to read xml file
public DataTable ReadXmlFile()
{
try
{
ReadXmlFs = new FileStream (

HttpContext.Current.Server.MapPath("~/test.xml"), FileMode.Open);
XmlTextReader rdXml = new XmlTextReader(ReadXmlFs);

ds.ReadXml(rdXml);

ReadXmlFs.Close();
return ds.Tables[0];
}
catch (Exception ex)
{
DataTable dTbl = new DataTable();
return dTbl;
}
}

No comments: