CSharp examples for System.Xml:XML File
XML Initialize Data from file path
using System.Xml.Linq; using System;//from w w w .ja v a2s . c om public class Main{ public static string XMLInitializeData(string strXMLFile, string strNodeName) { string controllerXML = string.Empty; XElement ugat = XElement.Load(@"C:\Controllers\" + strXMLFile + ".xml"); //controller = ugat.Elements("SearchSubmissionAPIControllerTest").Element("controller").Value; var elements = ugat.Elements(strNodeName); foreach (var item in elements) { controllerXML = item.Value; } return controllerXML; } }