XML解析后无法从NSDictionary中提取所需信息

时间:2013-11-07 17:18:32

标签: ios objective-c nsdictionary

解析后的我的NSDicioanry对象如下所示:

 result = { 
         node = ( { id = { text = 27; }; 
         img = { text = "/upload/iblock/1a1/1a84f.png"; }; 
         name = { text = rtrttrrt; }; price = { text = 0; }; 
         type = { text = 0; }; }, { id = { text = 28; }; 
         img = { text = "e.png"; }; name = { text = gdd; }; 
         price = { text = 0; }; 
         type = { text = 0; }; }, 
        { id = { text = 30; }; 
        img = { text = "9.png"; }; 
        name = { text = gfdghfdh; }; 
        price = { text = 0; }; 
        type = { text = 0; }; }, 
        { id = { text = 29; };
        img = { text = "8.png"; }; 
       name = { text = d; }; 
       price = { text = 0; }; 
       type = { text = 0; }; 
     } ); }; }

我正在尝试NSArray *titleArray =[[[xmlDictionary objectForKey:@"result"] objectForKey:@"node"] objectForKey:@"name"] valueForKey:@"text"];,但它不起作用。我的错误在哪里?

1 个答案:

答案 0 :(得分:0)

尝试

xmlDictionary[@"result"][@"node"][0][@"name"][@"text"]

看起来节点是一个数组,你在尝试时没有深入研究它。