C#XML格式字符串取节点数据

2021-07-03 19:12

阅读:652

标签:XML   int   参数   pat   val   document   ati   字符串   stat   

XML格式的字符串:

就像上面例子格式的字符串,如果参数0中放入数据SUCCESS,如何取得SUCCESS节点数据

这个节点一般都会存取敏感数据

public static string Deserialize(string xml)
{
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            string xpathChiefComplaint = "/xml/return_code";
            XmlNode xnChiefComplaint = doc.SelectSingleNode(xpathChiefComplaint);
            string nodeValue = xnChiefComplaint.InnerText;
            return nodeValue;
}

如上代码方法就能取到节点中的SUCCESS数据

C#XML格式字符串取节点数据

标签:XML   int   参数   pat   val   document   ati   字符串   stat   

原文地址:https://www.cnblogs.com/ButterflyEffect/p/9876910.html


评论


亲,登录后才可以留言!