Here is demo file xml and picture demo.
Collapse | Copy Code
-
-
1111 -
English -
2$ -
-
222 -
USA -
3$ -
-
3333 -
Singapore -
4$
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Maria BiliPosted Nov 18, 2012, 10:10 PM
VulpesPosted Nov 18, 2012, 7:42 PM
The code for the button Click eventhandler will be something like this:
Maria BiliPosted Nov 18, 2012, 7:06 PM
In this I think we a get value from textbox node/element value and transmit it to bookID and after that fill new value of bookName and change ? some one have some opinon ?
VulpesPosted Nov 18, 2012, 6:39 PM
This LINQ to XML code should do it:
using System;
using System.Linq;
using System.Xml.Linq;
class Test
{
static void Main()
{
XElement data = XElement.Load("demo.xml");
XElement searchBook = data.Elements("book").Where(book => book.Element("bookID").Value == "1111").FirstOrDefault();
if(searchBook != null)
{
searchBook.Element("bookPrice").Value = "1$";
data.Save("demo.xml");
}
}
}