/**** In response to my own question at: http://stackoverflow.com/questions/773651/xml-parsing-in-cocoa-touch-iphone SAMPLE XML: 460 Alcea rosea 'Nigra' Black Hollyhock 466 Amaranthus caudatus love-lies-bleedingLove Lies Bleeding 36428 Podocarpus macrophyllus 'Select Spreader' Japanese Yew 'Select Spreader' 36502 Spirea japonica 'limemound' Spirea Japonica 'Limemound' // See \n or \n\t in parse Array? make sure there are no "manually inserted" line breaks or tabs. *****/ - (NSMutableArray *) parseXMLWithStringData:(NSString *) Data { //NSLog(@"Starting XML Parsing"); CXMLDocument *xmlDoc = [[CXMLDocument alloc] initWithXMLString:Data options:0 error:nil]; NSArray *resultNodes=nil; NSMutableArray * Entries = [NSMutableArray new]; NSMutableDictionary *Item = [[NSMutableDictionary alloc] init]; resultNodes = [xmlDoc nodesForXPath:@"//entry" error:nil]; //NSLog(@"print nodes:%@", resultNodes); // Loop through the resultNodes to access each items actual data for (CXMLElement *resultElement in resultNodes) { int counter; //Get the child notes... for(counter = 0; counter < [resultElement childCount]; counter++) { if ([[[resultElement childAtIndex:counter] stringValue] isNotEqualTo:nil]) [Item setObject:[[resultElement childAtIndex:counter] stringValue] forKey:[[resultElement childAtIndex:counter] name]]; else [Item setObject:@"!~~~!" forKey:[[resultElement childAtIndex:counter] name]]; // !~~~! for nothing, nil, null } [Entries addObject:[Item copy]]; } [resultNodes release]; [Item release]; [Entries autorelease]; [xmlDoc release]; //NSLog(@"Printing Entries: %@", Entries); return Entries; }