标签:XML int 参数 pat val document ati 字符串 stat
XML格式的字符串:
<xml><return_code><![CDATA[{0}]]></return_code><return_msg><![CDATA[{1}]]></return_msg></xml>
就像上面例子格式的字符串,如果参数0中放入数据SUCCESS,如何取得SUCCESS节点数据
<[CDATA[{0}]]>这个节点一般都会存取敏感数据
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;
}
如上代码方法就能取到节点<[CDATA[{0}]]>中的SUCCESS数据
标签:XML int 参数 pat val document ati 字符串 stat
原文地址:https://www.cnblogs.com/ButterflyEffect/p/9876910.html