se puoi modificare la struttura, mettici:
codice:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soapenv:Body>
<ns:matchResponse xmlns:ns=\"…\">
<ns:return>
<![CDATA[
[{\"21\":{\"rank\":0.36787944117144233,\"tipo\":\"Maurolico\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"22\":{\"rank\":0.36787944117144233,\"tipo\":\"Papalina\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"17\":{\"rank\":0.36787944117144233,\"tipo\":\"Lacerto\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"18\":{\"rank\":0.36787944117144233,\"tipo\":\"Anguilla\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"15\":{\"rank\":0.36787944117144233,\"tipo\":\"Capone_gallinella\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"16\":{\"rank\":0.36787944117144233,\"tipo\":\"Boccanera\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"13\":{\"rank\":0.36787944117144233,\"tipo\":\"Boccanera\",\"H\":\"Alice\",\"K\":\"Alice\"}},{\"14\":{\"rank\":0.36787944117144233,\"tipo\":\"Lacerto\",\"H\":\"Alice\",\"K\":\"Alice\"}}]
]]>
</ns:return>
</ns:matchResponse>
</soapenv:Body>
</soapenv:Envelope>
In ogni caso, secondo me fai meglio ad usare
codice:
var matches = xmlHttpRequest.responseText.match(/<ns:return>(.*)<\/ns:return>/m)
//matches = ["<ns:return> [{\"21\":{\"rank\":0.36787944117144233, ... </ns:return>", "[{\"21\":{\"rank .... \"K\":\"Alice\"}}] "]
var json = eval(matches[1]);
N.B: ovviamente se inserisci il <![CDATA[ cambierai anche la RegExp sulla quale fai il match della stringa:
codice:
var matches = xmlHttpRequest.responseText.match(/<\!\[CDATA\[(.*)\]\]>/m)