How to update a XML file
-
Hi all, I have very newbie question concerning VB.NET and XML. I have an Xml file like this (simplified): 123 John Doe ... 890 Mary Somebody I can extract info from it but I don't know how to update it? Eg. Mary Somebody gets married and her name will be Mary Doe. I will be most grateful any advice or links to info. TIA Lasse Rantanen lasse.rantanen@jopiarvio.fi
-
Hi all, I have very newbie question concerning VB.NET and XML. I have an Xml file like this (simplified): 123 John Doe ... 890 Mary Somebody I can extract info from it but I don't know how to update it? Eg. Mary Somebody gets married and her name will be Mary Doe. I will be most grateful any advice or links to info. TIA Lasse Rantanen lasse.rantanen@jopiarvio.fi
in c#...
using System.Xml; . . . XmlDocument personnel = new XmlDocument(); personnel.Load(filename); XmlElement marysName = null; marysName = personnel.SelectSingleNode("//person[person_id/text() = '890']/name"); marysName.innerText = "Mary Doe"; personnel.Save(filename);
"When the only tool you have is a hammer, a sore thumb you will have."
-
in c#...
using System.Xml; . . . XmlDocument personnel = new XmlDocument(); personnel.Load(filename); XmlElement marysName = null; marysName = personnel.SelectSingleNode("//person[person_id/text() = '890']/name"); marysName.innerText = "Mary Doe"; personnel.Save(filename);
"When the only tool you have is a hammer, a sore thumb you will have."
-
Thanks, I have noticed that I usually get stuck with things which have rather simple solution. ;)
Often things are not simple nor obvious until you figure them out. Most of this is not too intuitive. Cheers.