If you use chldNode as XmlElement instead of XmlNode , you can use
var attributeValue = chldNode.GetAttribute("Name");
The return value will be an empty string if the attribute name does not exist.
So your loop might look like this:
XmlDocument document = new XmlDocument(); var nodes = document.SelectNodes("//Node/N0de/node"); foreach (XmlElement node in nodes) { var attributeValue = node.GetAttribute("Name"); }
This will select all the <node> surrounded by the <Node><N0de></N0de><Node> tags, and then scroll through them and read the Name attribute.
Marco7757 May 19 '16 at 12:01 2016-05-19 12:01
source share