Is it possible to parse a SOAP response with a jQuery xml handler?

前端 未结 2 1176
生来不讨喜
生来不讨喜 2020-12-07 03:05

I have the following SOAP response:




        
相关标签:
2条回答
  • 2020-12-07 03:43

    Short answer: yes. SOAP is XML. Any XML parser can read it. SOAP provides a whole layer of stuff using XML as the underlying data exchange format, but if you're not interested in using a SOAP library, an XML library will do it for you. Just makes more work for you.

    0 讨论(0)
  • 2020-12-07 04:01

    You need to escape special characters (the colon) using double backslashes \\

    var xmlText = $(xml).find("soap\\:Envelope")
                        .find("soap\\:Body")
                        .find("getPurseBalanceResponse")
                        .find("getPurseBalanceResult")
                        .find("balance").text();
    console.log(xmlText);
    

    Here is a working fiddle.

    0 讨论(0)
提交回复
热议问题