这样去获取试试:doc.DocumentElement.SelectSingleNode(...)
解决方案 »
- Active Directory authentication和windows Authentication到底有什么区别?谢谢!
- C#中定时器问题!!!
- datagridview 排序
- 对于同一个mdb文件中的同一个表,怎样实现不同的用户看见其中不同内容
- 大图片的处理问题!!将图片序列化为二进制流,还是用重画技术??????????
- 怎样在按钮事件中调用外部应用程序?
- 关于用C#设计KWIC(KEY WORD IN CONTEXT)系统设计模块,看不懂:(在线等注释,非常感谢!HELP!!给分答谢哦:)
- 如何在新的MDI子窗体打开时关闭其他子窗体?
- 请问怎样才能知道光驱的状态及硬盘的状态?????
- 安装.Net时碰到的问题,请大家帮忙!!!!!
- 这个函数在C#中如何调用?
- 130分求解决dateTimePicker背景颜色问题!在线等,急急急!另一开了100分贴等着给分!!
不行,因为SOAP-ENV是有命名空间前缀的,不加命名空间提示错误:(
/// 解析收到的Http响应,将body分解出来
/// </summary>
/// <param name="xmlMessage">收到的响应</param>
/// <param name="xmlMessageContent">Xml Body</param>
private void ParseContent(string xmlMessage,out string xmlMessageContent)
{
xmlMessageContent=xmlMessage.Substring(xmlMessage.IndexOf("<?")).Trim(); //Body //parse xml
byte[] byteSource=Encoding.GetEncoding("utf-8").GetBytes(xmlMessageContent);
MemoryStream ms =new MemoryStream(byteSource);
XmlTextReader reader=new XmlTextReader(ms);
string parseLog=null;
while(!reader.EOF)
{
if(reader.MoveToContent()==XmlNodeType.Element)
{
parseLog+=("\r\n\t"+reader.Name+":"+ReadValue(reader));
//处理关键字
}
else
{
reader.Read();
} }
Logs.writeLog(parseLog);
reader.Close();
ms.Close();
}
nsmgr.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope");
nsmgr.AddNamespace("SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding");上面的命名空间与你XML文件全不一样,都在最后少了一个"/"
应该是:http://schemas.xmlsoap.org/soap/envelope/
http://schemas.xmlsoap.org/soap/encoding/2、nsmgr.AddNamespace(String.Empty,"http://www.monternet.com/dsmp/schemas");
不能使用String.Empty:
--------------
try:XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
ns.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/");
ns.AddNamespace("SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/");
//注意下面的不同
ns.AddNamespace("xx","http://www.monternet.com/dsmp/schemas/");XmlNode node=doc.SelectSingleNode("SOAP-ENV:Envelope/SOAP-ENV:Header/xx:TransactionID",ns);