Sending information back from delegate [iPhone]
- by Andy
I'm using NSXMLParser in my RootViewController.m file.
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:response_data];
[xmlParser setDelegate:self];
[xmlParser parse];
[xmlParser release];
I'm also implementing this method to add entries to a dictionary defined in RootViewController.m for later use:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
However, I'd like to get more than one XML file and do different things when the file has finished; this sounds like I need to use external files as delegates. My question is:
If I have the following implementation files (& their header files):
RootViewController.m
XMLDelegate1.m
XMLDelegate2.m
and set the ith NSXMLParser delegate to be XMLDelegatei.m, and get those files to return an NSDictionary that I can then add to the NSDictionary defined in RootViewController.m.
I guess there are two methods of doing this:
Use a method that I don't know about; or
Use a better workflow
I suspect it's 2, but hope it's 1.
Thanks,
Andy