I’m using the XMLReader plugin found here https://github.com/Insert-Witty-Name/XML-to-NSDictionary to convert my XML data into an NS-Dictionary, but I am confused by how the dictionary is being set up. Here is what I am given:
{
response = {
"@status" = ok;
authentication = {
"@description" = "The username you provided is valid.";
"@login" = USERNAME;
"@response" = success;
"@user_id" = USERID;
};
};
}
I am trying to take the response object and say if key is equal to success then do something, but I’m not sure if this dictionary is even set up correctly.
Despite the weirdness of the @names as keys, it seems valid.
You could easily ask for your element response (
[ objectForKey:@"response"]), get the[ objectForKey:@"authentication"]and then[ objectForKey:@"@response"]to check[yourString isEqualToString:@"success"].Edit: Adding example
I’ve recently noticed some ; where commas should have been, but let’s hope that’s just a typo or something like it.
In case you have a doubt, you can always
NSLog(@"%@", [yourFirstDictionary allKeys]);to make sure those are valid keys.Let’s call your first object
myDictfor the sake of the example.