XML节点处理

XmlDocument xmlDoc = new XmlDocument();

                if (!File.Exists(xmlFileName))
                {
                    return string.Empty;
                }
                xmlDoc.Load(xmlFileName);
                XmlNodeList nodes = xmlDoc.SelectNodes(keyPath);

                foreach (XmlNode node in nodes)
                {
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == keyName.ToUpper())
                        {
                            string dataValue = childNode.InnerText;
                            return dataValue;
                        }
                    }
                }
原文地址:https://www.cnblogs.com/qigege/p/5157706.html