string DeviceManufacturer = null;//设备厂商
string DeviceOui = null;//设备制造商的唯一标识
string DeviceProductClass = null;//设备类型
string DeviceSerialNumber = null;//设备序列号
string Event = null;//引起此次会话建立的具体事件
//string MaxEnvelopes = null;//接受响应的信包的数目
string CurrentTime = null;//CPE当前的时间
string RetryCount = null;//完成inform调用前尝试的次数每次加1
string Inform = postData;//CPE设备参数列表
XmlDocument cwmpDocument = new XmlDocument();
cwmpDocument.LoadXml(cwmpXml);
XmlElement cwmproot = cwmpDocument.DocumentElement;
string cmwpNameSpace = cwmproot.NamespaceURI;
XmlNamespaceManager cwmpNsmgr = new XmlNamespaceManager(cwmpDocument.NameTable);
cwmpNsmgr.AddNamespace("soap", cmwpNameSpace);
cwmpNsmgr.AddNamespace("xsd", cmwpNameSpace);
cwmpNsmgr.AddNamespace("cwmp", cmwpNameSpace);
cwmpNsmgr.AddNamespace("soapenv", cmwpNameSpace);
cwmpNsmgr.AddNamespace("xsi", cmwpNameSpace);
//查询cwmp文档中的节点
DeviceManufacturer = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/DeviceId/Manufacturer", cwmpNsmgr).InnerText;
DeviceOui = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/DeviceId/OUI", cwmpNsmgr).InnerText;
DeviceProductClass = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/DeviceId/ProductClass", cwmpNsmgr).InnerText;
DeviceSerialNumber = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/DeviceId/SerialNumber", cwmpNsmgr).InnerText;
Event = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/Event", cwmpNsmgr).InnerXml;
CurrentTime = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/CurrentTime", cwmpNsmgr).InnerText;
RetryCount = cwmpDocument.SelectSingleNode(@"/cwmp:Inform/RetryCount", cwmpNsmgr).InnerText;
//ParameterList = cwmpDocument.SelectSingleNode("/soapenv:Envelope/soapenv:Body/cwmp:Inform/ParameterList".ToLower(), nsmgr).InnerXml;
标签:xml,cwmpNsmgr,string,Inform,null,cwmp,cwmpDocument,解析,SOAP
From: https://www.cnblogs.com/xiaoxihebei/p/17393973.html