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
Jay Webster
NA
67
0
[ANSWERED] Amend XML
Mar 18 2011 8:26 PM
Hi,
I have the following XML document:
<?xml version="1.0" encoding="ISO-8859-1"?>
<MAP>
<TILES>
<TILE ID="1">
<START>FALSE</START>
<EXIT>FALSE</EXIT>
</TILE>
<TILE ID="2">
<START>FALSE</START>
<EXIT>FALSE</EXIT>
</TILE>
<TILE ID="3">
<START>FALSE</START>
<EXIT>FALSE</EXIT>
</TILE>
</TILES>
</MAP>
If I want to say search for a tile node with id attribute of 3 and change the START node to TRUE.
I have got this so far:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("xmlfile.xml");
XmlNode node = xmlDoc.SelectSingleNode("/MAP/TILES/TILE/START");
node.Attributes[0].Value = "TRUE";
xmlDoc.Save("xmlfile.xml");
But I have no idea how to find and change only the node with ID = 3.
Thanks
Jay
Reply
Answers (
1
)
a way to make an app that runs in tray that pauses or freezes the screen (and unpauses) on a keypress?
Add a new book to an existing xml file.