RestKit with local XML

mrtopdog2000

New Member
I used RestKit to load XML data from a resource. That worked perfect, but now I want to change my whole program to read local XML files. I found the possibility to read a local xml file and parse it through RestKit in the Google RestKit Group:\[code\]NSString *string = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"testing" ofType:@"xml"] encoding:NSUTF8StringEncoding error:nil]; id<RKParser> parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:RKMIMETypeXML]; id result = [parser objectFromString:string error:nil]; NSLog(@"%@",[[[[result objectForKey:@"sample"] objectForKey:@"nested"] objectForKey:@"tags" ] description]); \[/code\]But now I want to load this object with my mapping. My old code with loading from a server:\[code\]RKObjectManager *objectManager = [RKObjectManager sharedManager];RKURL *URL = [RKURL URLWithBaseURL:[objectManager baseURL] resourcePath:[xmlFile path] queryParameters:nil];[objectManager.mappingProvider setMapping:myMapping forKeyPath:myKeyPath];[objectManager loadObjectsAtResourcePath:[NSString stringWithFormat:@"%@", [URL resourcePath]] usingBlock:^(RKObjectLoader *loader) { loader.delegate = self;}];\[/code\]After that I get my mapped objects in the didLoadObjects delegate of RestKit. How can I do the same for my local xml object?
 
Back
Top