XML值我有這樣的XML訪問使用jQuery
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<sizeResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sizeReturn xsi:type="xsd:int">1</sizeReturn>
</sizeResponse>
</soapenv:Body>
</soapenv:Envelope>
我想訪問1,但.find()不工作它給了我在我的控制檯此錯誤
Uncaught TypeError: Object <?xml version="1.0"
encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><sizeResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><sizeReturn
xsi:type="xsd:int">0</sizeReturn></sizeResponse></soapenv:Body></soapenv:Envelope>
has no method 'getElementsByTagName'
如何我可以使用jQuery或JS訪問它嗎(如果有一種使用Xpath插件的方式,請提供Xpath表達式)?
謝謝
我認爲這可以幫助你:[https://github.com/doedje/jquery.soap](https://github.com/doedje/jquery.soap) – vher2 2013-05-14 05:38:28
那不值得downvote – Ben 2013-05-14 07:43:54