Reputation: 281
I am calling the web services. The web service returns data in xml format. Now the problem is the xml data is not being received in proper format. In place of "<", ">" it returns in html form.
So I assigned the xmldata to a NsMutableString and replaced the escape characters so that the format of xml data is proper. Then I reassigned the NSMutableString to NSData so that I can parse the tags. but the problem is the xmlparser stops right where the xml data is, where I replaced the tags. It doesn't go further. What is going on?
This is the xml response from web service that I called.
<?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://aa.somewebservice.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>
And this is after I replaced the tags.
<?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://aa.somewebservice.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>
Now the problem is while parsing the xml data, the parser only goes up to return tag. And then it is stuck there.
Upvotes: 0
Views: 1336
Reputation: 318
What parser do you use? On the iPhone you can use different parsers (eg: TouchXML or TinyXML), try to use they...
Also I think you would remove <?xml version="1.0" encoding="utf-8"?>
from 'return' tag or replace it with another tag. Then when needed make the inverse transformation.
Upvotes: 1