Here is the XML outline:
<Root>
<Thing att="11">
<Child lang="e">
<record></record>
<record></record>
<record></record>
</Child >
<Child lang="f">
<record></record>
<record></record>
<record></record>
</Child >
</Thing>
</Root>
I have the following:
TextReader reader = new StreamReader(Assembly.GetExecutingAssembly()
.GetManifestResourceStream(FileName));
var data = XElement.Load(reader);
foreach (XElement single in Data.Elements())
{
// english records
var EnglishSet = (from e in single.Elements("Child")
where e.Attribute("lang").Equals("e")
select e.Value).FirstOrDefault();
}
But I'm getting back nothing. I want to be able to for Each "Thing" select the "Child" where the attribute "lang" equals a value.
I have also tried this, which has not worked.
var FrenchSet = single.Elements("Child")
.Where(y => y.Attribute("lang").Equals("f"))
.Select(x => x.Value).FirstOrDefault();