Parse multiple XML documents

Desperados

New Member
I need to make two web requests in my application, one that gets an interesting photo from flickr and another to get the size of the photo. I am able to get the ID list, but I don't know how to get the parse the size list. This is my code:\[code\]-(void)loadDataFromXML{NSURL *URL = [NSURL URLWithString:@"http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key=//MYAPIKEY//&per_page=1&format=rest"];NSData *Data = http://stackoverflow.com/questions/11377828/[NSData dataWithContentsOfURL:URL];NSXMLParser* parser = [[NSXMLParser alloc] initWithData: Data];[parser setDelegate:self];[parser parse];}- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{if ([elementName isEqualToString:@"photo"]) { NSString* title = [attributeDict valueForKey:@"title"]; NSString* iid = [attributeDict valueForKey:@"id"]; NSLog(@"Title: %@, ID: %@", title, iid); }}\[/code\]I tried putting this code below the NSLog above:\[code\]//START NEXT PASER//NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=//MYAPIKEY//&photo_id=%@&format=rest", iid]];NSData *Data = http://stackoverflow.com/questions/11377828/[NSData dataWithContentsOfURL:URL];NSXMLParser* sizelist = [[NSXMLParser alloc] initWithData: Data];[sizelist setDelegate:self];[sizelist parse];\[/code\]And add this void below it:\[code\]- (void)sizelist:(NSXMLParser *)sizelist didStartElement:(NSString *)elementName namespaceURI:(NSString *)namesoaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{if ([elementName isEqualToString:@"size"]) { NSString* size = [attributeDict valueForKey:@"size"]; NSString* source = [attributeDict valueForKey:@"source"]; NSLog(@"Size: %@, ID: %@", size, source);}}\[/code\]But I can't get the size to show up in the log. I'm new to Objective-C so thank in advance for making it simple!
 
Back
Top