通过promise返回一个promise对象,它是xml格式的,我要如何将它解析成json格式的?
它的格式如下:
"<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><GetCurrentRoomStatusGraphResponse xmlns="www.example.com"><GetCurrentRoomStatusGraphResult>
<RoomStatusGraphItem></RoomStatusGraphItem>
</GetCurrentRoomStatusGraphResult></GetCurrentRoomStatusGraphResponse>
</soap:Body></soap:Envelope>"
XML 其实就是可以理解为 HTML 嘛。
有 jquery 可以很好找。
没有 jquery 的话变成 DOM ,用原生的方法也可以