Select element with given attribute using linq to xml -
i've got following xml structure:
<artists> <artist> <name></name> <image size="small"></image> <image size="big"></image> </artist> </artists>
i need select name , image given attribute (size = big).
var q = c in feed.descendants("artist") select new { name = c.element("name").value, imgurl = c.element("image").value };
how can specify needed image attribute(size=big) in query above?
it's quite simple when know how!
var artistsandimage = in feed.descendants("artist") img in a.elements("image") img.attribute("size").value == "big" select new { name = a.element("name").value , image = img.value};
this return names , big images artists.
Comments
Post a Comment