我有以下SOAP響應:是否可以使用jQuery xml處理程序解析SOAP響應?
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getPurseBalanceResponse xmlns="https://secure.card.com/">
<getPurseBalanceResult>
<callStatus>
<Success>true</Success>
<ErrorCode/>
</callStatus>
<balance>63.35</balance>
<pending>30</pending>
<logoUrl>https://prepa.sqasddsad.com/ytm/images/logos/sq_cashlesscaterpurse3.gif</logoUrl>
<purseId>23456</purseId>
<CurrencyCode>GBP</CurrencyCode>
</getPurseBalanceResult>
</getPurseBalanceResponse>
</soap:Body>
</soap:Envelope>
我的問題是,我可以分析這與jQuery如下面...
var xmlText = $(xml).find("soap:Envelope").
find("soap:Body").
find("getPurseBalanceResponse").
find("getPurseBalanceResult").
find("balance").text();
console.log(xmlText);
目前此方法返回一個空字符串 - 這將是正確jQuery
調用來獲得「平衡」?
謝謝你,我不得不在選擇器中轉義特殊字符。 – Vinnyq12