Reading an XML file

Easy way of reading an xml file without linq or xpath

XmlDocument comment = new XmlDocument();
//full path. use .Load for URL
comment.LoadXml(File.ReadAllText(myfile.FullName));
XmlNodeList xnList = comment.SelectNodes("/RootNode");
foreach (XmlNode xn in xnList)
{
title = xn["Title"].InnerText;
description = xn["Content"].InnerText;
}

Comments

Popular posts from this blog

Breaking down document locking in SharePoint

Working around X-Frame-Options for iframes

Document ID not being generated