parse xml with C# using xdocument

solarboy

New Member
I have one very odd and strange xml(which is not my fault) and i want to get some info from it with c# and linq. XML is:\[code\]<Match BeginTime="2012-05-16T13:21:56.6737546+02:00" EndTime="2012-05-16T13:24:04.3994176+02:00" Winner="2"> <Period Number="1" MaximumDuration="PT2M" BeginTime="2012-05-16T13:21:56.6737546+02:00" EndTime="2012-05-16T13:22:25.3952338+02:00" MatchDuration="PT2M" Winner="2"> <Point Competitor="1" Value="http://stackoverflow.com/questions/10700486/1" MatchTime="PT6.5178048S" Time="2012-05-16T13:22:03.6018269+02:00" /> <Point Competitor="2" Value="http://stackoverflow.com/questions/10700486/2" MatchTime="PT1M57S" Time="2012-05-16T13:22:21.4017106+02:00" /> </Period> <Pause MaximumDuration="PT30S" AutomaticallyStartTime="true" BeginTime="2012-05-16T13:22:25.3952338+02:00" EndTime="2012-05-16T13:22:36.1092608+02:00" /> <Period Number="2" MaximumDuration="PT2M" BeginTime="2012-05-16T13:22:37.2592378+02:00" EndTime="2012-05-16T13:23:33.0777937+02:00" MatchDuration="PT2M" Winner="2"> <Point Competitor="2" Value="http://stackoverflow.com/questions/10700486/3" MatchTime="PT10.2121084S" Time="2012-05-16T13:22:47.4932385+02:00" /> <Point Competitor="1" Value="http://stackoverflow.com/questions/10700486/2" MatchTime="PT15.2950443S" Time="2012-05-16T13:22:52.5951376+02:00" /> <Point Competitor="2" Value="http://stackoverflow.com/questions/10700486/2" MatchTime="PT41.1295728S" Time="2012-05-16T13:23:18.3988393+02:00" /> </Period> <Pause MaximumDuration="PT30S" AutomaticallyStartTime="true" BeginTime="2012-05-16T13:23:33.0777937+02:00" /> <Period Number="3" MaximumDuration="PT2M" /></Match> \[/code\]As you can see i have 3 periods and in each period i have competitor number which is 1 or 2 and point for each competitor whic are in "Value", but in one period i can have more points("Values") for one competitor so i have to sum ti somehow, i am strugling with this one so any advice or help anyone?
 
Back
Top