Restkit mapping from an XML

ELZa3eem

New Member
I'm trying to map some data from an XML, but it doesn't all the way. XML:\[code\]<result> <items> <provider textid="text1" name="provider name 1"> <bags> <bag name="bag name 1" type="type" id="1"> <objects> <object textid="text1" id="1" description="desc 1"/> <object textid="text2" id="2" description="desc 2"/> <object textid="text3" id="3" description="desc 3"/>\[/code\]Objective-C\[code\] RKObjectMapping *providerMapping = [RKObjectMapping mappingForClass:[Provider class]];[providerMapping mapKeyPathsToAttributes:@"textid", @"textid", nil];[providerMapping mapKeyPathsToAttributes:@"name", @"name", nil];RKObjectMapping *bagMapping = [RKObjectMapping mappingForClass:[Bag class]];[bagMapping mapKeyPathsToAttributes:@"name", @"name", nil];[bagMapping mapKeyPathsToAttributes:@"type", @"type", nil];[bagMapping mapKeyPathsToAttributes:@"id", @"ID", nil];// Relationships[objectManager.mappingProvider setMapping:providerMapping forKeyPath:@"result.items.provider"];[objectManager.mappingProvider setMapping:bagMapping forKeyPath:@"result.items.provider.bags.bag"];[objectManager.mappingProvider addObjectMapping:providerMapping];[objectManager.mappingProvider addObjectMapping:bagMapping];\[/code\]I would like to list all the bag-objects, but there seems to be something wrong with the Relationships. I can get all the providers and it's content but how do I get only the "Bag"? Any ideas? Thanks,Mikael
 
Back
Top