By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

Open XML file, find record and update record

P: n/a
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!
Dec 4 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Arjen wrote:
Can someone help me to update my XML file? XmlDoc.Load(MapPath("~/myFile.xml")); 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 --- MVP XML
http://JavaScript.FAQTs.com/
Dec 4 '05 #2

P: n/a
"Martin Honnen" <ma*******@yahoo.de> schreef in bericht
news:%2******************@TK2MSFTNGP12.phx.gbl...


Arjen wrote:
Can someone help me to update my XML file?

XmlDoc.Load(MapPath("~/myFile.xml"));

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 --- MVP XML
http://JavaScript.FAQTs.com/

Thanks!

Arjen
Dec 4 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.