Change XML Attribute values during runtime in asp.net..

Posted by Gopal_nivas under ASP.NET on 2/24/2011 | Points: 10 | Views : 2464 | Status : [Member] | Replies : 1
hi..

i have a xml . in tat i have a values like this
<Sample Name="Vinod"/>

during run time i want to change the name attribute value of that xml..

how to do this.

and also give me the details about handling xml efficient way in .net.


need ur suggestions..
regards
gopal.s




Responses

Posted by: Karthikanbarasan on: 2/24/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Try this code


string path = "XML PATH";
XmlDocument doc = new XmlDocument();
doc.Load(path);
System.Xml.XmlNode appSettingsNode = doc.SelectSingleNode("Student");
foreach (System.Xml.XmlNode node in appSettingsNode)
{
node.Name.ToString();
if(node.Name == "Vinod")
{
node.InnerXml = "Karthik";
}
}


Thanks
Karthik
www.f5Debug.net

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response