nicklockwood / XMLDictionary

[DEPRECATED]
http://charcoaldesign.co.uk/source/cocoa#xml-dictionary
Other
1.14k stars 235 forks source link

foundCDATA not fired #25

Closed sadiq81 closed 9 years ago

sadiq81 commented 9 years ago

code example with url: http://matas-dev-stag.agillic.eu/apps/rest/userservice/loginuser?msisdn=20204545&password=12345678

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
//TODO use cache regardless of header
manager.responseSerializer = [AFXMLParserResponseSerializer serializer];

AFHTTPRequestOperation *operation = [manager GET:strUrl parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSDictionary *response =[NSDictionary dictionaryWithXMLParser:responseObject];
    completion(response);
}                                        failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    completion(nil);    
}];

return operation;

}

nicklockwood commented 9 years ago

I think you meant to use [NSDictionary dictionaryWithXML:responseObject]

nicklockwood commented 9 years ago

Wait, never mind. I'm not sure what the problem is. Can you paste in an example XML response that causes this error?

nicklockwood commented 9 years ago

Ha ha, sorry I see you already did. I'll try to read the report properly next time!

nicklockwood commented 9 years ago

Hi, sorry it took a while to get back to you. The reason this isn't parsing correctly is that these aren't proper CDATA tags. They've been pre-encoded. If you download the XML and open it in a text editor, you'll see that the tags are encoded as <![CDATA[...]]>

For that reason, the parser is interpreting them as plain text, not CDATA.

sadiq81 commented 9 years ago

Aha thanks, sry to bother you.