for loop in iPhone
Posted
by victor
on Stack Overflow
See other posts from Stack Overflow
or by victor
Published on 2010-06-10T10:26:52Z
Indexed on
2010/06/10
10:32 UTC
Read the original article
Hit count: 403
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!
© Stack Overflow or respective owner