/// <summary>
/// 获取XML字符串中Key对应的Value
/// </summary>
/// <param name="xmlContent"></param>
/// <param name="xmlKey"></param>
/// <returns></returns>
public static string GetXmlValue(string xmlContent, string xmlKey)
{
string xmlValue = "";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlContent);
XmlNode xnode = xmlDoc.DocumentElement;
foreach (XmlNode node in xnode.ChildNodes)
{
if (node.Attributes[0].Value == xmlKey)
{
xmlValue = node.InnerText;
}
}
return xmlValue;
}
获取XML字符串中Key对应的Value
最新推荐文章于 2021-02-20 11:13:03 发布