I searched the web for this, but I am not able to find any related solution.
I have following XML
<Table>
<Entity>Employee</Entity>
<EntityID>2786</EntityID>
<Goal>
<GoalId>31931</GoalId>
<FilterData>LastModifiedOn¥2014-03-20T18:11:01.0000000+05:30ÆActiveTaskCount¥0</FilterData>
</Goal>
<Goal>
<GoalId>31932</GoalId>
<FilterData>LastModifiedOn¥2014-03-22T15:26:09.0000000+05:30ÆActiveTaskCount¥0</FilterData>
</Goal>
<Goal>
<GoalId>31932</GoalId>
<FilterData>LastModifiedOn¥2014-03-22T09:25:00.0000000+05:30ÆActiveTaskCount¥0</FilterData>
</Goal>
</Table>
From above XML when I read the data I got 2 separate DataTables
; 1 for Employees and another one for related Goals.
What I needed is I want to sort all the Goals related to an employee with respect to LastModifiedOn
from FilterData
node.
NOTE: I am getting the LastModifiedOn value by split node value like this
nodevalue.Split('Æ')[0].Split('¥')[1]
Right now I am using System.XML namespace for doing operations. I also looked at LINQ TO XML but I am unable to make it work.
I am getting the XMLNodelist by following code
XmlNodeList GoalNodesList = doc.DocumentElement.SelectNodes("/NewDataSet/Table[Entity='Employee' and EntityID='" + EntityId + "']/Goal");
Here I want the Sorted Goals (with respect to LastModifiedOn
).
I also looked at some useful links but didn't get any idea so far
I am ready to convert the code into LINQ TO XML
but needed a brief example.