xmlParsing 时字符损坏
我正在调用一个返回 xml 数据的 Web 服务。现在当我收到xml数据时,它全部被扭曲了。所有转义字符,如“<”、“>”和“'”被转换为html格式
即≶>和“。
所以现在,解析器无法识别标签。
这是我从 webservice 的响应
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:GetCustomerInfoResponse xmlns:ns1="http://qa2.alliancetek.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?><customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
返回标签之间的内容是 xml 数据。当我将 xml 数据复制到 NSMutableString 变量中,并执行替换字符操作时,然后它也没有改变。
I am calling a webservice which returns xml data. Now when I receive the xml data, it is all distorted. all the escape characters like "<", ">" and " ' " are converted to html format
i.e. ≶ > and ".
So now, the parser is not able to recognize the tags.
This is my response from webservice
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:GetCustomerInfoResponse xmlns:ns1="http://qa2.alliancetek.com/phpwebservice">
<return xsi:type="xsd:string">
<?xml version="1.0" encoding="utf-8"?><customer><id>1</id><customername>Hitesh</customername><phonenumber>98989898</phonenumber></customer>
</return>
</ns1:GetCustomerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The content between the return tags are xml data. When I copied the xml data into a NSMutableString variable, and performed replace characters operation, then also it didn't change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请替换出现的 ≶ &tg;和 " 带有空格。
Please replace occurences of ≶ &tg; and " with a whitespace.