作業中のブログに問題があります。私が解析に使用している方法は次のとおりです。
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"];
}
}
編集:XMLは次のように見えます:
<item>
<title>Your Direction Determines Your Destination</title>
<link>http://treymorgan.podbean.com/2012/06/05/your-direction-determines-your-destination/</link>
<comments>http://treymorgan.podbean.com/2012/06/05/your-direction-determines-your-destination/#comments</comments>
<pubDate>Tue, 05 Jun 2012 17:57:07 +0000</pubDate>
<dc:creator>treymorgan</dc:creator>
<category></category>
<guid isPermaLink="false">http://treymorgan.podbean.com/2012/06/05/your-direction-determines-your-destination/</guid>
<description><![CDATA[Part 1 of the series … Road Trip
]]></description>
<content:encoded><![CDATA[<p>Part 1 of the series … Road Trip
</p>
]]></content:encoded>
<wfw:commentRss>http://treymorgan.podbean.com/2012/06/05/your-direction-determines-your-destination/feed/</wfw:commentRss>
<enclosure url="http://treymorgan.podbean.com/mf/feed/x52488/DirectionDeterminesyourDestination.mp3" length="32015229" type="audio/mpeg"/>
</item>
このようにして、XML内のTitleタグから記事のタイトルを取得できます。私が解析したほとんどのxmlには、「guid」または「link」タグのいずれかにmp3が含まれています。ただし、現在使用しているフィードは次のようになります。
<enclosure url="http://treymorgan.podbean.com/mf/feed/bf8mvq/Accommoditions.mp3" length="29865594" type="audio/mpeg"/>
エンクロージャーからNSStringにURLを渡すにはどうすればよいですか?