Hi boys and girls!
I have an xml file that looks for example like this:
-
-
-
-
Nombre1
Nombre2
Nombre3
-
Lat1
Lat2
Lat3
-
Long1
Long2
Long3
Then, my program do some stuff and has a new value to put for example in the place where is "Long1".
How can I overwrite that value in the xml file without to write the
whole xml again?
If is not posible tell me the best way to perform that task
Thanks in advance and if it has been posted before please refer me to that post because i haven't found it.
csharphelpPosted Oct 28, 2005, 12:17 AM
XmlDocument doc = new XmlDocument();
doc.Load(docPath);
foreach (XmlNode node in doc.SelectNodes("//path"))
{
node.InnerText = this.TxtPath.Text;
}
doc.Save(docPath);
Jonathan MitchemPosted Sep 15, 2005, 1:36 PM
Stan GershengorenPosted Sep 15, 2005, 1:20 PM
What I would suggest is using XmlDocument object
use Load method to load the entire file, use SelectSingleNode to find the node, and use Save method
to write the file back to the file system.
Hope that helps