Hi there, I have to parse a xml & return the values for val & id (attribute). I have pasted a sample xml below. <response> <field> <values> <val id="AL"> Alabama</val> . . . <val id="WY">Wyoming</val> </values> </field> <field> <values> <val id="1">Australia</val> . . . <val id="150">Zambia</val> </values> </field> </response> I am able to retrieve the val(Alabama, Austalia...) & display it in a table view. I need to get the attribute values (AL, 1) - to know which val has been selected. I need to get the attribute value. but i am not sure to get the attribute value according to the click of the val. Can some help me to get through this one please!!!! Also i am able to get the attribute values in didstartelement of xml parser by : tagid = [attributeDict objectForKey:@"id"]; But I am not aware of how to add this value to a array something similar to : - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ currentElement = [elementName copy]; if ([elementName isEqualToString:@"val"]) { item = [[NSMutableDictionary alloc] init]; tagid = [attributeDict objectForKey:@"id"]; ( I am getting all the values of attribute here) } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if ([elementName isEqualToString:@"val"]) { [item setObject:errorcode forKey:@"val"]; [item setObject:obtID forKey:@"Id"]; [item objectForKey:@"id"]; [stories addObject:[item copy]]; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ if ([currentElement isEqualToString:@"val"]){ [errorcode appendString:string]; } else if ([currentElement isEqualToString:@"Id"]) { obtrowid = string; [obtID appendString:string]; } } I need to retrieve the values of - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; retselval = [[stories objectAtIndex: storyIndex] objectForKey: @"val"]; //retseltag = [dupattr objectForKey:@"id"]; ( This is where I am trying to read the attribute values) } _______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com