S
SPS101
Hello All
I have the following XML, I want to get a list of all the Activity
References Id and there parents which can be
Running, Biking, Other, MultiSport or a custom extension that I can define.
What is the best way to get the Parent Name and Attritubte in my code below,
<Folders>
<History>
<Running Name="Sample Running">
<ActivityRef>
<Id>2008-06-14T18:19:57Z</Id>
</ActivityRef>
</Running>
<Biking Name="Sample Biking">
<ActivityRef>
<Id>2008-07-04T19:46:07Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-22T21:14:22Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-15T22:24:13Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-14T18:19:57Z</Id>
</ActivityRef>
</Biking>
</History>
<Folders>
IEnumerable<ActivityReference> activityRefs = from actRef in
root.Descendants(ns1 + "Folders").Descendants(ns1 +
"History").Descendants(ns1 + "ActivityRef")
select new ActivityReference
{
Id = DateTime.Parse(actRef.Element(ns1 + "Id").Value),
Parent = " Get Parent Node - Biking,Running Etc. ",
ParentName = " Get Parent Node Name Attribute = 'Running Sample'",
};
I have the following XML, I want to get a list of all the Activity
References Id and there parents which can be
Running, Biking, Other, MultiSport or a custom extension that I can define.
What is the best way to get the Parent Name and Attritubte in my code below,
<Folders>
<History>
<Running Name="Sample Running">
<ActivityRef>
<Id>2008-06-14T18:19:57Z</Id>
</ActivityRef>
</Running>
<Biking Name="Sample Biking">
<ActivityRef>
<Id>2008-07-04T19:46:07Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-22T21:14:22Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-15T22:24:13Z</Id>
</ActivityRef>
<ActivityRef>
<Id>2008-06-14T18:19:57Z</Id>
</ActivityRef>
</Biking>
</History>
<Folders>
IEnumerable<ActivityReference> activityRefs = from actRef in
root.Descendants(ns1 + "Folders").Descendants(ns1 +
"History").Descendants(ns1 + "ActivityRef")
select new ActivityReference
{
Id = DateTime.Parse(actRef.Element(ns1 + "Id").Value),
Parent = " Get Parent Node - Biking,Running Etc. ",
ParentName = " Get Parent Node Name Attribute = 'Running Sample'",
};