Enterprise Windows and Linux Solutions. http://technicallywired.blogspot.com/rss.xml
Thursday, November 08, 2018
C# XmlDocument Example
static void LoadCopySources()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlfilename);
var serverList = xmlDoc.SelectNodes("//servers/server");
foreach (XmlNode aServer in serverList)
{
Console.WriteLine(aServer.Attributes["name"].Value);
var memList = aServer.SelectNodes("servicestomonitor/service");
foreach (XmlNode x in memList)
{
Console.WriteLine(x.InnerText);
}
}
var copySourceList = xmlDoc.SelectNodes("//copysources/copysource");
foreach (XmlNode src in copySourceList)
{
//Console.WriteLine(src.InnerXml);
LstCopySources.Add(src.InnerXml);
}
foreach(var astr in LstCopySources)
{
Console.WriteLine(astr);
}
Console.WriteLine("stop");
}
Subscribe to:
Posts (Atom)