I have a XML like this:
<rss>
<channel>
<item>
<title>something</title>
<description>...</description>
<category>cooking</category>
<category>housing</category>
</item>
<item>
...
</item>
...
</channel>
</rss>
It's a RSS Feed, with an array of items inside a channel, containing many tag/properties (title, content,...), with a collection of category tags.
I can parse it with RestKit for the channel/item/title/content part with this:
RKManagedObjectMapping *itemMapping = [RKManagedObjectMapping mappingForClass:[Item class] inManagedObjectStore:objectStore];
[itemMapping mapKeyPath:@"title" toAttribute:@"title"];
[itemMapping mapKeyPath:@"description" toAttribute:@"content"];
RKManagedObjectMapping *channelMapping = [RKManagedObjectMapping mappingForClass:[Channel class] inManagedObjectStore:objectStore];
[channelMapping mapKeyPath:@"item" toRelationship:@"items" withMapping:itemMapping];
[manager.mappingProvider setMapping:channelMapping forKeyPath:@"rss.channel"];
But I'm at lost for mapping categories... I've tried something like that:
RKManagedObjectMapping *categoryMapping = [RKManagedObjectMapping mappingForClass:[Category class] inManagedObjectStore:objectStore];
[itemMapping mapKeyPath:@"category" toRelationship:@"categories" withMapping:CategoryMapping]
But somehow the text content inside the tag is not mapped to my propertie 'name' inside the Category class. For sure I didn't use this 'name' in the code here, because I don't know where to put it.
How can I parse text-only XML tag with RestKit? Is there something like:
[categoryMapping mapKeyPath:@".text" toAttribute:@"name"];
?
(doesn't work as is)