I have a question regarding the parsing of an XLM document more precisely the ATOM format data. (RSS feed).
Here is an sample of the xlm document:
<item>
<title>Panty + Stocking Print Preview</title>
<link>http://SonicRocksMySocks.deviantart.com/art/Panty-Stocking-Print-Preview-200615179</link>
<guid isPermaLink="true">http://SonicRocksMySocks.deviantart.com/art/Panty-Stocking-Print-Preview-200615179</guid>
<pubDate>Fri, 11 Mar 2011 21:43:34 PST</pubDate>
<media:title type="plain">Panty + Stocking Print Preview</media:title>
<media:keywords></media:keywords>
<media:rating>nonadult</media:rating>
<media:category label="Movies & TV">fanart/digital/drawings/movies</media:category>
<media:credit role="author" scheme="urn:ebu">SonicRocksMySocks</media:credit>
<media:credit role="author" scheme="urn:ebu">http://a.deviantart.net/avatars/s/o/sonicrocksmysocks.png?15</media:credit>
<media:copyright url="http://sonicrocksmysocks.deviantart.com">Copyright 2011 *SonicRocksMySocks</media:copyright>
<media:thumbnail url="http://th00.deviantart.net/fs71/300W/i/2011/070/d/c/panty___stocking_print_preview_by_sonicrocksmysocks-d3bfvnv.png" height="351" width="300"/>
<media:thumbnail url="http://th02.deviantart.net/fs71/150/i/2011/070/d/c/panty___stocking_print_preview_by_sonicrocksmysocks-d3bfvnv.png" height="150" width="128"/>
<media:content url="http://th08.deviantart.net/fs71/PRE/i/2011/070/d/c/panty___stocking_print_preview_by_sonicrocksmysocks-d3bfvnv.png" height="967" width="826" medium="image"/>
<media:content url="http://www.deviantart.com/download/200615179/" medium="document"/>
<description><![CDATA[ The final version of this print will be available for sale at Sakura Con 2011. :3<br /><div><img src="http://th00.deviantart.net/fs71/300W/i/2011/070/d/c/panty___stocking_print_preview_by_sonicrocksmysocks-d3bfvnv.png" alt="thumbnail" /></div> ]]></description>
<media:description type="html"><![CDATA[ The final version of this print will be available for sale at Sakura Con 2011. :3 ]]></media:description>
</item>
This is how I parse the title, pubDate and link values:
NSArray *channels = [rootElement elementsForName:@"channel"];
for (GDataXMLElement *channel in channels)
{
NSString *blogTitle = [channel valueForChild:@"title"];
NSArray *items = [channel elementsForName:@"item"];
for (GDataXMLElement *item in items)
{
NSString *articleTitle = [item valueForChild:@"title"];
NSString *articleUrl = [item valueForChild:@"link"];
NSString *articleDateString = [item valueForChild:@"pubDate"];
NSDate *articleDate = [NSDate dateFromInternetDateTimeString:articleDateString formatHint:DateFormatHintRFC822];
RSSEntry *entry = [[[RSSEntry alloc] initWithBlogTitle:blogTitle
articleTitle:articleTitle
articleUrl:articleUrl
articleDate:articleDate] autorelease];
[entries addObject:entry];
}
}
I don't know how to retrieve the media:content line. How can I do it? Can anyone help me with this?
Thank you a lot, Andrei
Have you tried iterating through the children of item
and examining them in the debugger or NSLog?