Вы должны проанализировать все соответствующие дочерние узлы:
for (CXMLElement *node in nodes) {
for (CXMLNode *childNode1 in [node children]) {
NSString *nodeName1 = [childNode1 name]; // should contain item_1 in first iteration
NSString *nodeValue1 = [[childNode1 stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // should contain 'text' in first iteration
NSLog(@"NodeName1, NodeValue1: %@, %@", nodeName1, nodeValue1);
if ([[childNode1 name] isEqualToString:@"title"]) {
NSLog(@"I am here!");
[item setObject:nodeValue1 forKey:nodeName1];
[res addObject:item];
}
for (CXMLNode *childNode2 in [childNode1 children]) {
// NSString *nodeName2 = [childNode2 name]; // should contain item_1 in first iteration
// NSString *nodeValue2 = [[childNode2 stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // should contain 'text' in first iteration
// NSLog(@"NodeName2, NodeValue2: %@, %@", nodeName2, nodeValue2);
for (CXMLNode *childNode3 in [childNode2 children]) {
//NSString *nodeName3 = [childNode3 name]; // should contain item_1 in first iteration
//NSString *nodeValue3 = [[childNode3 stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // should contain 'text' in first iteration
//NSLog(@"NodeName3, NodeValue3: %@, %@", nodeName3, nodeValue3);
for (CXMLNode *childNode4 in [childNode3 children]) {
// NSString *nodeName4 = [childNode4 name]; // should contain item_1 in first iteration
// NSString *nodeValue4 = [[childNode4 stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // should contain 'text' in first iteration
// NSLog(@"NodeValue4: %@", nodeValue4);
for (CXMLNode *childNode5 in [childNode4 children]) {
// NSString *nodeName5 = [childNode5 name]; // should contain item_1 in first iteration
// NSString *nodeValue5 = [[childNode5 stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // should contain 'text' in first iteration
// NSLog(@"NodeName5, NodeValue5: %@, %@", nodeName5, nodeValue5);
}
}
}
}
}
[item release];
}