I am trying to get the value of the attribute "Id" inside the entity element from the class with the name of "ECMInstruction" but nothing is returned.
<?xml version="1.0" encoding="utf-8"?>
<Root>
<Class Name="ECMInstruction" Style="Top">
<Entity Id="1" Name="DocumentInformation" />
</Class>
<Class Name="dfgfggfdg" Style="Top">
<Entity Id="1" Name="dfgfgfdgd" />
</Class>
</Root>
private void dcLisT_SelectedIndexChanged(object sender, EventArgs e)
{
String curItem = dcList.SelectedItem.ToString();
IEnumerable<String> lList =
from el in doc.Descendants("Entity")
where el.ElementsBeforeSelf("Class") && Attribute("Name").Value == curItem
select (String)el.Attribute("Id").Value;
EntityList.Items.AddRange(lList.ToArray());
}
No comments:
Post a Comment