Find a specific node in XML using XmlDocument, XmlNodeList and XmlNode in C#

private void FindXmlDataItem(int sIndex)
{
    XmlDocument docXml = new XmlDocument();
    docXml.Load(Server.MapPath(@"App_Data\myXmlFile.xml"));
    XmlNodeList list = docXml.DocumentElement.ChildNodes;
    XmlNode node = list.Item(sIndex);
    this.txtUser.Text = node["User"].InnerText;
    this.txtPass.Text = node["Password"].InnerText;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.