XD["soap:Envelope"]["soap:Body"]["GetIDCardInfoResponse"]

解决方案 »

  1.   

    谢谢 AngelGavin(Gavin Lv)
    你的方法可以的 但是如果是这种情况
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <GetIDCardInfoResponse xmlns="http://tempuri.org/">
          <GetIDCardInfoResult>string</GetIDCardInfoResult>
          <GetIDCardInfoResult1>string111</GetIDCardInfoResult1>
          <GetIDCardInfoResult2>string222</GetIDCardInfoResult2>
          <GetIDCardInfoResult3>string333</GetIDCardInfoResult3>
          <GetIDCardInfoResult4>string444</GetIDCardInfoResult4>
        </GetIDCardInfoResponse>
        <GetIDCardInfoResponse xmlns="http://tempuri.org/">
          <GetIDCardInfoResult>rrrstring</GetIDCardInfoResult>
          <GetIDCardInfoResult1>rrrstring111</GetIDCardInfoResult1>
          <GetIDCardInfoResult2>rrrstring222</GetIDCardInfoResult2>
          <GetIDCardInfoResult3>rrrstring333</GetIDCardInfoResult3>
          <GetIDCardInfoResult4>rrrstring444</GetIDCardInfoResult4>
        </GetIDCardInfoResponse>
      </soap:Body>
    </soap:Envelope>
    用你的方法 好像只能取出来 第一个匹配的 我如果要取rrrstring111这个值怎么办?
      

  2.   

    XmlNode XN=XD.SelectSingleNode(@"soap:Envelope/soap:Body/GetIDCardInfoResponse[2]/GetIDCardInfoResult",XNM);
      

  3.   

    Response.Write(XD["soap:Envelope"]["soap:Body"].LastChild["GetIDCardInfoResult1"].InnerText);
    哈哈 我已经试验成功了 谢谢你
      

  4.   

    SelectNodes()可以得到多个节点
    SelectSingleNodes()只得到一个节点
      

  5.   

    TO:net_lover(孟子E章)
    我这样处理了 但是不行啊 直到问题出在那里么?
    System.Xml.XmlNamespaceManager XNM=new XmlNamespaceManager(XD.NameTable);
    XNM.AddNamespace("soap",@"http://schemas.xmlsoap.org/soap/envelope/");
    //XNM.AddNamespace("xsi",@"http://www.w3.org/2001/XMLSchema-instance");
    //XNM.AddNamespace("xsd",@"http://www.w3.org/2001/XMLSchema");
    //XNM.AddNamespace("GetIDCardInfoResponse",@"http://tempuri.org/");
    //Response.Write(XD["soap:Envelope"]["soap:Body"].LastChild["GetIDCardInfoResult"].InnerText);
    XmlNode XN=XD.SelectSingleNode(@"soap:Envelope/soap:Body/GetIDCardInfoResponse[1]/GetIDCardInfoResult",XNM);
    Response.Write(XN.InnerText);