Hi all,
I'm trying to retrieve some specific data from an XML file I have attached. The data is in <LinkCollection>
I have a semi populated class object that contains an ID that directly relates to the LinkItem ID. Matching these values I then want to populate the rest of the class with the other data - Path, Index and any DescriptiveText held under that ID.
My attempt is here but I'm returning dodgy string values and getting nowhere slowly.
I'm trying to retrieve some specific data from an XML file I have attached. The data is in <LinkCollection>
I have a semi populated class object that contains an ID that directly relates to the LinkItem ID. Matching these values I then want to populate the rest of the class with the other data - Path, Index and any DescriptiveText held under that ID.
My attempt is here but I'm returning dodgy string values and getting nowhere slowly.
Code:
//gets icon path and index
foreach (LinkItem item in linkItems)
{
var Index = from LinkIcon in xmlDoc.Descendants("LinkIcon")
where (string)LinkIcon.Parent.Attribute("ID") == item.LinkID
select LinkIcon.Attribute("Index").Value;
item.IconIndex = Index.ToString();
var Path = from LinkCollection in xmlDoc.Descendants("LinkItem")
where LinkCollection.Attribute("ID").Value == item.LinkID
select LinkCollection.Descendants("LinkIcon").Attributes("Path");
item.IconPath = Path.ToString();
}