using System.Xml; namespace Common { public class XMLhelper { public static XmlDocument Xml = new XmlDocument(); public static string GetNode(string nodeNmae) { var xn = Xml.SelectSingleNode("root"); if (xn == null) { return string.Empty; } // 得到根节点的所有子节点 XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xn1 in xnl) { if (xn1.Name == nodeNmae) { return xn1.InnerText; } } return string.Empty; } } }