for loop in iPhone
- by victor
nodes = [doc nodesForXPath:@"//user" error: nil];
for (CXMLElement *node in nodes) {
[itemPreDict setObject:[[node attributeForName:@"name"] stringValue] forKey:@"name"];
[itemPreDict setObject:[[node attributeForName:@"gender"] stringValue] forKey:@"gender"];
[itemPreDict setObject:[[node attributeForName:@"dob"] stringValue] forKey:@"dob"];
[itemDict setObject:itemPreDict forKey:[[node attributeForName:@"name"] stringValue]];
}
In the end of loop, I'm getting 10 dicts (10 users) with same info for last user in a list, how can I get 10 dicts with different user info. Help Me Please!