I have redone this question as a few have suggested that it is difficult to understand what I am after so have cut down the question somewhat.
<?xml version="1.0"?>
<root>
<succesfulResponses>
<position>0</position>
<response>
<dln>BBUTU204250VS9VT</dln>
<licence>
<entitlements>
<code>A</code>
<validFrom/>
<validTo/>
<priorTo>false</priorTo>
<type>F</type>
</entitlements>
<entitlements>
<code>B</code>
<validFrom/>
<validTo/>
<priorTo>false</priorTo>
<type>F</type>
</entitlements>
</licence>
</response>
</succesfulResponses>
<succesfulResponses>
<position>1</position>
<response>
<dln>BTXRS755313Y99AT</dln>
<licence>
<entitlements>
<code>A</code>
<validFrom>2003-02-28</validFrom>
<validTo>2043-05-30</validTo>
<priorTo>false</priorTo>
<type>P</type>
</entitlements>
<entitlements>
<code>AM</code>
<validFrom>2014-05-14</validFrom>
<validTo>2043-05-30</validTo>
<priorTo>false</priorTo>
<type>P</type>
</entitlements>
</licence>
<httpStatusCode>200</httpStatusCode>
</response>
</succesfulResponses>
</root>
This is the XML I have returned, I submit several ID's to the service and it returns this XML.
If I send 2 ID's it returns 2 'successfulResponses' elements for each ID these ID's you can see in the child node 'dln' beneath 'response', you can see they are different.
'position' is simply which ID i submitted in the 'request' first. 'response' also has an element called 'licence' and several 'entitlement' elements.
I wish to insert these 'entitlements' into a datatable that is formatted in this way
Results.EntitlementsTbl.Columns.Add(New DataColumn("Code", GetType(String)))
Results.EntitlementsTbl.Columns.Add(New DataColumn("Valid From", GetType(String)))
Results.EntitlementsTbl.Columns.Add(New DataColumn("Valid To", GetType(String)))
Results.EntitlementsTbl.Columns.Add(New DataColumn("Prior To", GetType(String)))
Results.EntitlementsTbl.Columns.Add(New DataColumn("Type", GetType(String)))
Results.EntitlementsTbl.Columns.Add(New DataColumn("Driver", GetType(String)))
Each column relates to an node beneath each 'entitlements' element. I wish to add a new row to my datatable everytime I have an 'entitlements' element.
There is an additional column 'Driver', this needs to be populated with the number in 'position'.
So my the output to my table I would like to have the following:
As you can see the 'Driver' Column relates to the value of the 'position' node.
I hope this makes more sense than my previous. I have removed any of my own code I have stated I have done as its clearly not what was required.
dln, but using positions from all drivers, what entitlements do you want and where do you want them?