I tried to get the attributes from XNode I use the following code
XDocument document = XDocument.Load(FilePath);
var Elements = from p in document.Descendants(modality) select p.Elements("Key_Part");
//var Attriputess = from p in document.Descendants(modality) select p.Attributes();
foreach (var Element in Elements)
{
foreach (var node in Element.Nodes())
{
XmlReader reader = node.CreateReader();
string a = reader.GetAttribute("Type");
}
}
a always equal null the XML type like this
<ShortcutList Version="8">
<Doctor>
<Key_Part >
<Key1 Name = "XX" Type= "XXXXXXXXX" > rrrr</Key1>
<Key2 Name = "XasfsaX" Type= "XXXXsafasfXXXXX" > rrsfsfrr</Key1>
</Key_Part>
I want to get Key1 , Key2 attributes and value