读取XML

来源:互联网 发布:男生不主动追女生知乎 编辑:程序博客网 时间:2024/05/29 13:04
        private static XmlNode ReadXmlNode(string xmlpath, string path)
        {
            try
            {
                //解析字符串
                XmlDocument xmlDoc = new XmlDocument();
                //装载文件
                xmlDoc.Load(xmlpath);
                //获取节点
                XmlNode RootNode = xmlDoc.SelectSingleNode(path);
                return RootNode;
            }
            catch (Exception ex)
            {
                CommonFunction.WriteExceptionLog(ex);
                return null;
            }
        }