Hi
I tried this
//XmlNode deleteNode = addresses.SelectSingleNode("addresses/customer");
//addressesItems = addresses.SelectNodes("addresses/customer");
//Create FileStream fs
FileStream fs = new FileStream(currentPath, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
//Create new XmlDocument
System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
//Load the contents of the filestream into the XmlDocument (xmldoc)
xmldoc.Load(fs);
//close the fs filestream
fs.Close();
//Remove the xml node
xmldoc.DocumentElement.RemoveChild(xmldoc.Document Element.ChildNodes[nodeNo]);
// Create the filestream for saving
FileStream WRITER = new FileStream(currentPath, FileMode.Truncate,
FileAccess.Write, FileShare.ReadWrite);
// Save the xmldocument
xmldoc.Save(WRITER);
//Close the writer filestream
WRITER.Close();
But I get exception on line FileStream WRITER = new FileStream(currentPath,
FileMode.Truncate, FileAccess.Write, FileShare.ReadWrite);
Użytkownik "IgorM" <ig***@live.comnapisał w wiadomo¶ci
news:uP*************@TK2MSFTNGP02.phx.gbl...
Hi
I'm using the code below to allow user to browse through some xml
document.
System.IO.StreamReader sr = new System.IO.StreamReader(currentPath);
System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
System.Xml.XmlDocument addresses = new System.Xml.XmlDocument();
addresses.Load(xr);
addressesItems = addresses.SelectNodes("addresses/customer");
tbEntrySought.Text =
addressesItems.Item(NodeNo).SelectSingleNode("uniq ueaddressline").InnerText;
tbMatchingEntry.Text =
addressesItems.Item(NodeNo).SelectSingleNode("addr ess_line1").InnerText +
"\r\n";
User has the ability to click a Delete button to delete a current item
form xml. How can I do that using Item number?
Kind regards
IgorM