i have a xml like this
<rootnode>
<lvl1>AIT</lvl1>
<lvl2>
<a>0</a>
<b> 111</b>
</lvl2>
</rootnode>
xml parsing code below
public class accountlist
{
public string lvl1 { get; set; }
public List<string> b { get; set; }
}
List<accountlist> questions = (from c in xmlDoc.Descendants("rootnode")
select new accountlist
{
lvl1 = c.Element("rootnode").Value,
b = (from q in c.Descendants("lvl2").Elements("b").Elements("a") where q.Element("a").Value == "0"
select q.Value).ToList(),
}).ToList();
my output should be like this
lvl1 = AIT
b = 111
please help me……
Try the following query.
It looks like you are going to get a list of b in your result set, if you need simple values of lvl1 and b then