Thap Ba

Thap Ba

  • NA
  • 2
  • 549

iterate through an xml file, which contains values and date time

Jul 29 2022 7:27 PM

Hi,

I'm new here, I have a project to collect the total number of hours each day on a month.  The file is an xml format.  I need to know how to iterate through each day, add up all the values until the end of the xml file.  I really need help.

this is a sample data: 

   

and my code :

class Program{

 const string fn = @"c:\temp\test.xml";

static void Main(string[] args){

   xmlDocument xdoc = new xmldocument();

xdoc.Load(fn);

xmlnodelist v = xdoc.getelementsbytagname("Value");

xmlnodelist st = xdoc.getelementsbytagname("st")[0];

xmlnodelist et = xdoc.getelementsbytagname("et")[0];

foreach (xmlnode value in values){

I'm stuck on how to add up all the value numbers here....help please!

}

}

 

 

}


Answers (1)