XML feed mapping - Error Domain Code=1001

250 views
Skip to first unread message

neppoz

unread,
Feb 8, 2012, 5:44:24 PM2/8/12
to RestKit
Hello all,

please help me out with this. I try to do a Object Mapping for a rss
feed. I get a ""RKObjectMapperKeyPath, NSLocalizedDescription=Could
not find an object mapping for keyPath: '' error.

The feed itself is big so i only post the inital raw data:

<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl'
href='http://feeds.ilsole24ore.com/xsl/it/rss.xsl'?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://
purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/
1999/02/22-rdf-syntax-ns#" version="2.0"><channel><title>Il Sole 24
ORE - Homepage</title><link>http://www.ilsole24ore.com</
link><description>Il Sole 24 ORE - Homepage</description><language>it-
IT</language><copyright>Copyright 2005 - IlSole24ORE.com</
copyright><pubDate>Wed, 08 Feb 2012 21:47:16 GMT</
pubDate><lastBuildDate>Wed, 08 Feb 2012 21:47:16 GMT</
lastBuildDate><ttl>5</ttl><image><title>Il Sole 24 ORE - Homepage</
title><url>http://www.ilsole24ore.com/rss/img/logo_sole2.png</
url><link>http://www.ilsole24ore.com</
link><description>IlSole24ORE.com</description></
image><item><title>Milano chiude in rialzo con le banche. Spread in
area 350</title><link>http://feeds.ilsole24ore.com/c/32276/f/438662/s/
1c7bb047/l/
0L0Silsole24ore0N0Cart0Cfinanza0Ee0Emercati0C20A120E0A20E0A80Cchiusura0Erialzo0Etokyo0Espread0E0A832120Bshtml0Duuid0FAahYrfoE/
story01.htm</link><description> ..................

Here my code to parse the data above:

// Configure the output level
RKLogConfigureByName("RestKit/Network", RKLogLevelDebug);

// Define the parser to use
[[RKParserRegistry sharedRegistry] setParserClass:
[RKXMLParserLibXML class] forMIMEType:@"application/rss+xml"];

// Define the mapping
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:
[SimpleAccount class]];
[mapping mapKeyPathsToAttributes:@"title", @"title", nil];

// Fetch the content from server
RKObjectManager* manager = [RKObjectManager
objectManagerWithBaseURL:@"http://www.ilsole24ore.com"];
[manager.mappingProvider setObjectMapping:mapping
forKeyPath:@"channel.item"];
[manager loadObjectsAtResourcePath:@"/rss/primapagina.xml"
delegate:self];

Thank you in advance, i am stuck here.

Jonathan Hoskin

unread,
Feb 8, 2012, 5:50:10 PM2/8/12
to res...@googlegroups.com
Have you tried rss.channel.item for the keyPath?

-- 
Jonathan Hoskin

neppoz

unread,
Feb 9, 2012, 4:16:48 AM2/9/12
to RestKit
Now i tried "rss.channel.item" and it works. You saved my day.

Thanks.

On 8 Feb., 23:50, Jonathan Hoskin <jonat...@hosk.in> wrote:
> Have you tried rss.channel.item for the keyPath?
>
> --
> Jonathan Hoskin
>
>
>
>
>
>
>
> On Thursday, 9 February 2012 at 11:44 AM, neppoz wrote:
> > Hello all,
>
> > please help me out with this. I try to do a Object Mapping for a rss
> > feed. I get a ""RKObjectMapperKeyPath, NSLocalizedDescription=Could
> > not find an object mapping for keyPath: '' error.
>
> > The feed itself is big so i only post the inital raw data:
>
> > <?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl'
> > href='http://feeds.ilsole24ore.com/xsl/it/rss.xsl'?>
> > <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
> > xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://
> > purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/
> > 1999/02/22-rdf-syntax-ns#" version="2.0"><channel><title>Il Sole 24
> > ORE - Homepage</title><link>http://www.ilsole24ore.com</
> > link><description>Il Sole 24 ORE - Homepage</description><language>it-
> > IT</language><copyright>Copyright 2005 - IlSole24ORE.com (http://IlSole24ORE.com)</
> > copyright><pubDate>Wed, 08 Feb 2012 21:47:16 GMT</
> > pubDate><lastBuildDate>Wed, 08 Feb 2012 21:47:16 GMT</
> > lastBuildDate><ttl>5</ttl><image><title>Il Sole 24 ORE - Homepage</
> > title><url>http://www.ilsole24ore.com/rss/img/logo_sole2.png</
> > url><link>http://www.ilsole24ore.com</
> > link><description>IlSole24ORE.com (http://IlSole24ORE.com)</description></
Reply all
Reply to author
Forward
0 new messages