Open XML file, find record and update record

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hi,

Can someone help me to update my XML file?
This is what I have.

XmlDoc.Load(MapPath("~/myFile.xml"));
XmlNodeList oXmlUser = oXmlDoc.GetElementsByTagName("user");

foreach (XmlNode user in oXmlUser) {
// if user found, update and save/update file
}

I can find the user. And think to update it like this:
user.ChildNodes.Item(1).InnerText = "new";

But I don't know how to save/update the file.
How can I do that?

Thanks!
 
Arjen said:
Can someone help me to update my XML file?

But I don't know how to save/update the file.

XmlDoc.Save(MapPath("~/myFile.xml"));
But make sure the user that ASP.NET is being executed with has the
proper permissions to write to the directory and to overwrite the file.
 
Martin Honnen said:
XmlDoc.Save(MapPath("~/myFile.xml"));
But make sure the user that ASP.NET is being executed with has the proper
permissions to write to the directory and to overwrite the file.


Thanks!

Arjen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top