I'm fledgling in iOS, so please bare with the naive question. So I'm trying to work .net web service. I'm able to fetch the response from web service, the response is like beow
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getDoctorListResponse
xmlns="http://tempuri.org/"><getDoctorListResult>
[
{
"Zone": "CENTRAL NORTH",
"DoctorName": "Dr Ang Kiam Hwee",
},
{
"Zone": "CENTRAL",
"DoctorName": "Dr Lee Eng Seng",
}
]
</getDoctorListResult>
</getDoctorListResponse>
</soap:Body>
</soap:Envelope>
With the below code I'm able to get the only json
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if ([currentElement isEqualToString:@"getDoctorListResult"]) {
NSDictionary *dc = (NSDictionary *) string;
NSLog(@"Dictionary is = \n%@", dc);
}
}
The variable dc which looks like json is equal to
[
{
"Zone": "CENTRAL NORTH",
"DoctorName": "Dr Ang Kiam Hwee",
},
{
"Zone": "CENTRAL",
"DoctorName": "Dr Lee Eng Seng",
}
]
I have checked many similar questions like Xcode how to parse Json Objects, json parsing+iphone and other similar questions but couldn't solve my problem.
How can I get the values of Zone and DoctorName and store it in Array then display it in TableView?