如何高效读取并解析XML配置文件?

更新于
2026-07-27 13:20:04
21阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计215个文字,预计阅读时间需要1分钟。

如何高效读取并解析XML配置文件?

读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml节点名称及值public static String getConfigValue(String nodeName) // // 读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml节点名称及值 // / / GisServiceConfig.xml

读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xmlXML节点名称节点值publicstaticstringGetConfigVa

///

///读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml

///

///XML节点名称

///节点

public static string GetConfigValue(string p_key)

{

XmlDocument doc = new XmlDocument();

string cOnfig= "";

string xmlPath = AppDomain.CurrentDomain.BaseDirectory"GisServiceConfig.xml"; //获取"GisServiceConfig.xml"文件的路径

doc.Load(xmlPath);

if(!xmlPath)

如何高效读取并解析XML配置文件?

{

XElement element = XElement.Parse(doc.InnerXml);

cOnfig= element.Element(p_key).Value;

return config;

}

else

{

return "":

}

}

读取.XML配置文件,布布扣,bubuko.com

本文共计215个文字,预计阅读时间需要1分钟。

如何高效读取并解析XML配置文件?

读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml节点名称及值public static String getConfigValue(String nodeName) // // 读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml节点名称及值 // / / GisServiceConfig.xml

读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xmlXML节点名称节点值publicstaticstringGetConfigVa

///

///读取配置文件信息,配置文件服务器程序当前路径下GisServiceConfig.xml

///

///XML节点名称

///节点

public static string GetConfigValue(string p_key)

{

XmlDocument doc = new XmlDocument();

string cOnfig= "";

string xmlPath = AppDomain.CurrentDomain.BaseDirectory"GisServiceConfig.xml"; //获取"GisServiceConfig.xml"文件的路径

doc.Load(xmlPath);

if(!xmlPath)

如何高效读取并解析XML配置文件?

{

XElement element = XElement.Parse(doc.InnerXml);

cOnfig= element.Element(p_key).Value;

return config;

}

else

{

return "":

}

}

读取.XML配置文件,布布扣,bubuko.com