Getting multiple data items in an element with linq to xml
Posted
by Maestro1024
on Stack Overflow
See other posts from Stack Overflow
or by Maestro1024
Published on 2010-05-06T21:02:03Z
Indexed on
2010/05/06
21:08 UTC
Read the original article
Hit count: 433
linq-to-xml
|Xml
Getting multiple data items in an element with linq to xml
I have an xml file like this
<TopLevel>
<Inside>
Jibba
</Inside>
<Inside>
Jabba
</Inside>
</TopLevel>
I was given said xml and and want to get all the elements. Here is the code I have.
var q = from c in loaded.Descendants("TopLevel")
select (XElement)c.Element("Inside");
I tried c.Elements but that did not work. What do I need to do to get all of the internal elements? This code just gets the first "Inside" tag.
© Stack Overflow or respective owner