Most Efficient Way to Read XML

------------ Coding is all what I know -------------

Being a Microsoft technology developer, Reading XML is a very basic task, to read. Write or transfer data. Whether it be RSS feeds or Database data access, everywhere its all XML , There are a lot of ways to read XML using XPATH language XPATHNAVIGATOR, browsing through each nodes and finally extracting data. This is so complex and of course lot of coding. I have suggested an easy and efficient way to READ XML  

String xmlURL = “ “;     // Specify any RSS Feed Url

             XmlReader xReaderResult = null;



                    xReaderResult = XmlReader.Create(xmlUrl, settings);

                    doc.Load(xReaderResult); // Loading the XML Document


                catch (XmlException ex)


                    throw new Exception("error RSS feed is not well formed: " + ex.Message);



                XmlNode nRoot = doc.DocumentElement;

                XmlNodeList xNodeList = nRoot.SelectNodes("channel/item"); // Selecting the Nodes in XML in this case for RSS feeds


                XmlTextReader xReader;

                // Dumping the RSS Data into Datatable

                for (int x = 0; x < xNodeList.Count; x++)


                    xReader = new XmlTextReader(xNodeList.Item(x).OuterXml, XmlNodeType.Element, new XmlParserContext(null, null, null, XmlSpace.None));

                    ds.ReadXml(xReader, XmlReadMode.InferSchema);



                dt = ds.Tables[0];


             dt.TableName = this.Title;


After Getting the XML data into the Datatable you can extract the data and get each of the node data or bind it to a Grid View and display the data in Grid Fashion


Extracting the XML data from datatable


                              int k = 0;

                       foreach( Datarow oDr in dt.Rows)


           titleArray[k] = oDr[“Title”]; // Extract each Node

                  pubdateArray[k] = oDR[“pubdate”];




Binding it to Gridview




Thanks Enjoy !!!!