471,338 Members | 952 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Open XML file, find record and update record

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
2 2161


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
"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.

Similar topics

2 posts views Thread by BT3 | last post: by
4 posts views Thread by Andras Gilicz | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.