Search and Update xml file

Posted by Sp under ASP.NET on 1/19/2011 | Points: 10 | Views : 1709 | Status : [Member] | Replies : 1
i am having a xml file, i am providing it as an attachment...
Now, i want to search and update content within this file based on patient id. I have stored refernce of patientId in viewstate, i want to search for the coressponding patient iD node in this file and then update the ReportStatus node
The code i am using now..
XmlDocument doc = new XmlDocument();

string xmlFile = System.Web.HttpContext.Current.Server.MapPath("~/Database/abc.xml");
XmlNodeList xmlnode = doc.SelectNodes("//Patients[contains(PatientID,' " + ViewState["id"] + " ')]");
for (int i = 0; i < xmlnode.Count; i++) // Loops only once if record exists
xmlnode[i].ChildNodes[8].InnerText = "Reported";

... this code is returning xmlnode count as zero thought the coressponding PatientID exists...


Posted by: Sp on: 1/19/2011 [Member] Starter | Points: 25

The attachment associated with my question is here.....
 Download source file

Sp, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response