I have just taken over a project from another engineer and the system he was using stored data results in XML files, however I need to go through and replace a certain data string with another based on an pre-requisite. As I'm learning C# at the moment I figured it might be a nice little learning project at the same time.
The two XML nodes I'm looking at are Number and the Terminal address
What we are doing is looking at the (Host)Number (In this case 000421) and then changing the IP address to the new address based on a new criteria. Now in theory this would be a simple user find and replace task however with over 100,000 results and multiple IP's for each (Host)Number that's carpel tunnel syndrome for anyone who attempts it plus new ones are being generated every day so its a but of an uphill struggle.
<Terminal address="18.104.22.168" Port="76"/>
<other irrelevant data>
So far I have a very simple bit of code that checks the root folder then creates a subfolder for each (Host)Number it finds and puts all the matching files into there no problems, what I would then like to do is pull out all the Terminal address and replace them however I assumed I could use the same code but as its not the same type of data (if that's the right wording) where as the nodes are easy to find with
XDocument doc = XDocument.Load(@"location\file.xml");
var Host = doc.Descendants("number");
foreach (var number in Host)
however trying to get the Terminal address is eluding me a bit, If i change the node to Transfer if brings back everything except the Terminal address and Port.
Any help would be greatly appreciated.