Below is just a sample of my xml that I want to add too. What I want to do is be able to traverse through adding information to each parent foler.
In my example below folder name="national" has numberOfRecords 2 as it only has 2 as the total number of records inside that folder. Whereas folder
name outlet has a total number of records equal to seven as there are seven files under it. and so does folder name C, and so on. I want to be able
to traverse through and add a new attribute (numberOfRecords) to folders, national, outlet & C. I am trying to make this completely
generic so that whatever is added, can also be correctly calulated. I mean each folder can have as many folders as can be, each with as many files as can be.
I am using C#. LinqToXML, Basically I dont want to use the words folder and file at all, I want to do it all using LINQS alternative to XPATH AXES.
I know it sounds complex. Though I'm sure it is not to someone out there as it is a fairly common task to perform.
Thanks in advance.
<?xml version="1.0" encoding="utf-8"?>
<folder name="national" >
<folder name="dir2" numberOfRecords="0"/>
<folder name="dir3" numberOfRecords="2">
<file name="tester" />
<file name="helper" />
<folder numberOfRecords="5" />
<file name="help" />
<file name="tester2" />
<file name="tester3" />
<file name="tester4" />
<file name="tester5" />