I am parsing a xml document, I need find out the gid (an attribute) value (3810).
Based on SelectSingleNode(). I found it is not easy to find the attri
SelectSingleNode()
You can query XmlDocument itself not DocumentRoot:
XmlDocument
DocumentRoot
XmlDocument doc = new XmlDocument(); XmlNode book = doc.SelectSingleNode(".."); if (book != null) { XmlAttribute gid = book.Attributes["gid"]; if (gid != null) { string value = gid.Value; } }