<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<exampleResponse xmlns:ns1="http://hellows">
<ns1:out>消息是:sdf</ns1:out>
</exampleResponse>
</soap:Body>
</soap:Envelope>怎样取出?
消息是:sdf

解决方案 »

  1.   

    doucment.getElementsByTagName("ns1")[0].split(":")[1]
      

  2.   

    $(xmlResult).find('ns1:out').eq(0).text();//jquery取不出来!
      

  3.   

    你这样吧
    $(xmlResult).find("exampleResponse").children().eq(0).text());
    因为find('ns1:out'),jquery会认为是找有out属性的ns1.
      

  4.   

    $(xmlResult).find("exampleResponse").children().eq(0).text()
    最后多了个括号刚才
      

  5.   

    在线等,网上还没查到资料!
    cokeetang,我试过你给我的方法但还不行!
      

  6.   


    var resultNode = xmlResult.documentElement.firstChild.firstChild.firstChild;
    var resultValue = resultNode.firstChild.nodeValue;
    alert(resultValue);
    这样可以实现,jq如何?
      

  7.   

    其实这是IE兼容性的问题 你到ff上测试我的代码就没问题,在IE下浏览器不识别不是默认的标签。所以要
    document.createElement("exampleResponse");一下才行。
    下面可运行的IE代码,你试下,根据你的情况改:
    <html>
    <head>
    <script type="text/javascript" src='jquery.js'></script>
    <script  type="text/javascript">
    document.createElement("exampleResponse");
    $(function(){
    alert($("body").find("exampleResponse").text());
    });
    </script>
    </head>
    <body>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soap:Body> 
    <exampleResponse xmlns:ns1="http://hellows"> 
    <ns1:out>消息是:sdf </ns1:out> 
    </exampleResponse> 
    </soap:Body> 
    </soap:Envelope> 
    </body>
    </html>