.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Modify XML File in C#.net

Posted By: Narayanan     Posted Date: August 26, 2011    Points:5   Category :C#
Hi friends,
I am using XML File in my Project.I want to modify that xmlfile.it means i want to change the existing data.Please tell me.
For Example :
XML Format:
<?xml version="1.0" encoding="utf-8"?>
<personneldata>
<Configuration>
<firstname>Lakshmi</firstname>
<lastname>narayanan</lastname>
<age>28</age>
</Configuration>
</personneldata>
I want to change the age(not only age,any node) value at runtime .Please tell me how to achieve this ?

Responses
Author: Vinodh             
Posted Date: August 26, 2011     Points: 20   

Hi,
tryusing GetelemtbyId and Save()

xmlnodeList list= xmlDocument.GetElementByTagName("age");
for(int j=0; j<=list.Count; j++)
list[i].Innerxml="27"

xmlDocument.Save();

Author: Narayanan             
Posted Date: August 27, 2011     Points: 20   

Hi ,
thanks for u reply

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend