reading xml and counting node

Posted by Nvskhan under C# on 5/16/2014 | Points: 10 | Views : 1170 | Status : [Member] | Replies : 1
hi,

i have a xml which contain some integer value, i have to check value is greater than 100 or not. if its greater than 100 then i need to increment one value and in the end i have to produce number of node has more than 100 value.

the sample xml is,

<Modules>
<Module Name="LexisNexis.Alerts.dll" AssemblyVersion="1.0.0.0" FileVersion="1.0.0.0">
<Metrics>
<Metric Name="MaintainabilityIndex" Value="84" />
<Metric Name="CyclomaticComplexity" Value="2,178" />
<Metric Name="ClassCoupling" Value="448" />
<Metric Name="DepthOfInheritance" Value="7" />
<Metric Name="LinesOfCode" Value="4,120" />
</Metrics>




Responses

Posted by: Sheonarayan on: 5/19/2014 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
You can do it by modifying the XML file however that is little tedious as you will have to use many other namespaces of respective classes.

I would recommend reading it into DataSet, modifying the data and regenerating the xml file similar to explained in this article http://www.dotnetfunda.com/articles/show/1390/reading-and-updating-data-to-xml-file-using-csharp-in-aspnet.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Nvskhan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response