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

Top 5 Contributors of the Month
Easy Web
Imran Ghani

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

removing a record from xml file

Posted By: softraj     Posted Date: February 27, 2010    Points:2   Category :C#
How to remove a record from xml file from c#.net application?

Author: Lalij Mer             
Posted Date: February 27, 2010     Points: 5   

show this code

string strXml = "<Samp><Batch><CRUISE>CRUISE</CRUISE><HNUM>HNUM</HNUM></Batch><Batch><CRUISE>11111</CRUISE><HNUM>2</HNUM></Batch></Samp>";
using(StringReader rd = new StringReader(strXml))
XmlTextReader rd1 = new XmlTextReader(rd);
using(DataSet ds = new DataSet())
XmlReadMode xmlRead = ds.ReadXml(rd1);
// Delete the first row
// overwrite the string
strXml = ds.GetXml();



Please Check my answer if you help....
Thank You...

Author: Sagar Pardeshi             
Posted Date: March 02, 2010     Points: 5   

XmlNodeList newXMLNodes = XMLDom.SelectNodes("/PNode/Node1");
foreach(XmlNode newXMLNode in newXMLNodes)
if(newXMLNode.InnerText == "sree")
XMLDom.Save("Path of your XML file");
XMLDom = null;

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

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