返回的xml格式无法通过xml直接解析
<ns1:registByChannelResponse xmlns:ns1="http://service.services.commlife.apps.gateway.sinosoft.com/"><ns1:return><?xml version="1.0" encoding="GBK"?>
<channelClaim>
<head>
<consumerID>JZINS</consumerID>
<RequestType>autoRegist</RequestType>
<status>1</status>
<errorCode>0000</errorCode>
<errorMsg>报案成功!</errorMsg>
</head>
<body>
<plcNo>627062020430103000007</plcNo>
<registrNo>727062020430103000015</registrNo>
</body>
</channelClaim>
</ns1:return></ns1:registByChannelResponse>
需要先htmldecode一下再进行解析
Encodes.unescapeHtml(result);
JSONObject xmlJSONObj = XML.toJSONObject(result);
String s = xmlJSONObj.getJSONObject("ns1:registByChannelResponse").getJSONObject("ns1:return").getStr("channelClaim").toString();