How to append a xml file?
i have a xml file called my.xml i need to edit the each nodes and attributes and values?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Blocked AccountPosted Nov 1, 2008, 4:56 AM
Hi,
By using this code u can edit the xml file here PageNumber is used as the ID of the page.
string FileName = MapPath("/PageTitle.xml");
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(FileName);
XmlNodeList nodeList = xmlDoc.SelectNodes("/PageTitle/Page[@ID=" + PageNumber.ToString() + "]");
nodeList[0].ChildNodes[1].InnerText = ViewState["PageTitle"].ToString();
xmlDoc.Save(FileName);
Happy Coding!!