aVC
aVC

Reputation: 2344

Accessing the xml values from NSDictionary

I am using this xmlreader. Here is my code

NSDictionary *xmlDict = [XMLReader dictionaryForXMLString:responseString error:&error1];
NSLog(@"XMLData: %@",xmlDict);

I can save and log the data and it looks like this.

response =     {
        Gpn0 =         {
            text = 10000;
        };
        Gsn0 =         {
            text = 4;
        };
        btn0 =         {
            text = up;
        };        
    };
}

But how can I access a single element from this dictionary?

Upvotes: 0

Views: 42

Answers (1)

Ismael
Ismael

Reputation: 3937

NSDictionary *gpn0 = response[@"Gpn0"];
NSNumber *gpn0_text = gpno[@"text"]; // note this is a numeric value

NSDictionary *btn0 = response[@"btn0"];
NSString *btn0_text = gpno[@"text"]; // note this is a string value    

so on and so forth

Upvotes: 1

Related Questions