XML 文字列は次のようになります。
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; };
} ); }; }
私はそれを解析して、次のように NSDictionary (xmlDictionary と呼ばれる) を取得します。
result = `{ content = ( { text = "iPhone - shit"; }, { text = "iPad = cool"; } ); date = ( { text = "4 december"; }, { text = "16 december"; } ); title = ( { text = "News about iPhone"; }, { text = "News about iPad"; } ); type = ( { text = "News 1"; }, { text = "News 2"; } ); }; }
タイトルのテキストなど、各要素の属性を取得するにはどうすればよいですか? 私はしようとしています:
NSString *str =[[[[xmlDictionary objectForKey:@"result"] objectForKey:@"type"] objectForKey:@"title"] stringForKey:@"text"];
しかし、うまくいきません。どうすればいいですか?