Hey Guys...
I've got a bit of a fiddly problem...
I have an XML doc in the following format:
<row>
<DNOrPattern>0444</DNOrPattern>
<HuntList>HL-1104 C Capital</HuntList>
<LineGroup>LG-1000-COREVM1</LineGroup>
<RNAReversionTimeout>4</RNAReversionTimeout>
<DistributionAlgorithm>Top Down</DistributionAlgorithm>
<Member>20130</Member>
</row>
<row>
<DNOrPattern>1015</DNOrPattern>
<HuntList>HL-1104 B Ltd</HuntList>
<LineGroup>LG-1000-COREVM1</LineGroup>
<RNAReversionTimeout>4</RNAReversionTimeout>
<DistributionAlgorithm>Top Down</DistributionAlgorithm>
<Member>20110</Member>
</row>
<row>
<DNOrPattern>0444</DNOrPattern>
<HuntList>HL-1104 C Capital</HuntList>
<LineGroup>LG-1000-COREVM1</LineGroup>
<RNAReversionTimeout>4</RNAReversionTimeout>
<DistributionAlgorithm>Top Down</DistributionAlgorithm>
<Member>20110</Member>
</row>
<row>
<DNOrPattern>0444</DNOrPattern>
<HuntList>HL-1104 C Capital</HuntList>
<LineGroup>LG-1104 C Capital</LineGroup>
<RNAReversionTimeout>12</RNAReversionTimeout>
<DistributionAlgorithm>Top Down</DistributionAlgorithm>
<Member>11048624</Member>
</row>
<row>
<DNOrPattern>1015</DNOrPattern>
<HuntList>HL-1104 B Ltd</HuntList>
<LineGroup>LG-1104 B</LineGroup>
<RNAReversionTimeout>4</RNAReversionTimeout>
<DistributionAlgorithm>Top Down</DistributionAlgorithm>
<Member>20132</Member>
</row>
I want to read it into some sort of heirarchy along these lines....
DNOrPattern
HuntList
LineGroup
Members
So from the data above i end up with the data in this logical heirarchy i.e. for each DNorPattern i can expand to see the hunt list then expand the huntlist to see the linegroups then expand the linegroups to see the members! (I'm putting this in code to keep the indentation)
DNOrPattern: 1015
HuntList: HL-1104 B Ltd
LineGroup: LG-1000-COREVM1
Member: 20110
LineGroup: LG-1104 B
Member: 20132
DNOrPattern: 0444
HuntList: HL-1104 C Capital
LineGroup: LG-1000-COREVM1
Member: 20110
Member: 20130
LineGroup: LG-1104 C Capital
Member: 11048624
Hope that makes some sense....
I think Linq should be able to do this but i dont know where to begin really...
this is how i've started (the table is stored in StoreSoap.SoapHuntDoc as an XDocument)
var rows = from row in StoreSoap.SoapHuntDoc.Descendants("row")
select new
{
Pilot = row.Element("DNOrPattern").Value,
HuntList = row.Element("HuntList").Value,
LineGroup = row.Element("LineGroup").Value,
RNA = row.Element("RNAReversionTimeout").Value,
DistributionAlgorithm = row.Element("DistributionAlgorithm").Value,
Member = row.Element("Member").Value,
};