TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Memento
NA
111
133.5k
c# - winform - how to update particular xml node
Apr 15 2012 12:55 PM
My xml file:
<?xml version="1.0" standalone="yes"?>
<Food>
<Fruit>
<name>apple</name>
<color>red</color>
<taste>sweet</taste>
<price>4</price>
</Fruit>
</Food>
I load this file into forms controls - without problems, but if i change the value of some controls and want to update particular xml node - nothing happens. For example, i want to change the price of apple, according to my TextBox1.Text:
file01 = new XmlDocument();
file01.Load(filePath);
XmlElement root = file01.DocumentElement;
XmlNodeList nodes = root.SelectNodes("/Food/Fruit");
foreach (XmlNode node in nodes)
{
if (node["name"].InnerText == "apple")
{
node["price"].InnerText = textBox1.Text;}}
I also tried TextBox1.Text convert to string - also nothing happend. XML file remains unchanged.
Any suggestion, pls. How to finish ?
Reply
Answers (
3
)
iNTERNET
Internet packets