Hello.
I am able to read XML data from disk into strings. I obviously created these strings manually. Is there a way to achieve this dynamically?
Let's say at some point the XML file changes and I want to add a node for first name in the XML file. Is there a way that my C# program could read this first name into a string without me defining it previously?Code:XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(message); XmlNodeList name = xDoc.GetElementsByTagName("myName"); XmlNodeList telephone = xDoc.GetElementsByTagName("myTelephone"); XmlNodeList email = xDoc.GetElementsByTagName("myEmail"); XmlNodeList age = xDoc.GetElementsByTagName("myAge"); XmlNodeList sex = xDoc.GetElementsByTagName("mySex"); mname = name[0].InnerText; mtel = telephone[0].InnerText; memail = email[0].InnerText; mage = age[0].InnerText; msex = sex[0].InnerText;
Any help is appreciated.




Reply With Quote