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 with its nodes; 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 i
th NSXMLParser delegate to be XMLDelegatei
.m, how can i get those files to return an NSDictionary that I can then add to the NSDictionary defined in RootViewController.m?
I guess there are two possible answers:
- 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
UPDATE: So I've found a way of achieving the goal, although I'm not convinced it's the nicest way. Basically, I get my delegate to update a Plist file and use the Notification Center to discover when this happens.