Saturday, 22 June 2013

Parsing XML not getting the enclosure


i trying parse xml of podcast able download or stream mp3 in xml. here part of code parsing it:
code:
- (void)parseatom:(gdataxmlelement *)rootelement entries:(nsmutablearray *)entries {            nsstring *blogtitle = [rootelement valueforchild:@"title"];                                nsarray *items = [rootelement elementsforname:@"entry"];      (gdataxmlelement *item in items) {                    nsstring *articletitle = [item valueforchild:@"title"];          nsstring *articleurl = nil;          nsarray *links = [item elementsforname:@"guid"];          for(gdataxmlelement *link in links) {              nsstring *rel = [[link attributeforname:@"rel"] stringvalue];              nsstring *type = [[link attributeforname:@"type"] stringvalue];               if ([rel compare:@"alternate"] == nsorderedsame &&                   [type compare:@"text/html"] == nsorderedsame) {                  articleurl = [[link attributeforname:@"href"] stringvalue];              }          }                    nsstring *articledatestring = [item valueforchild:@"updated"];                  nsdate *articledate = [nsdate datefrominternetdatetimestring:articledatestring formathint:dateformathintrfc3339];                    rssentry *entry = [[[rssentry alloc] initwithblogtitle:blogtitle                                                     articletitle:articletitle                                                       articleurl:articleurl                                                      articledate:articledate] autorelease];          [entries addobject:entry];                }              }  
here 1 of 'episodes' xml
code:
<item>    		<title>a place @ table</title>  		<link>http://www.smcoc.net/index.php?option=com_biblestudy&view=studydetails&id=299&templatemenuid=20&itemid=1</link>  		<comments>http://www.smcoc.net/index.php?option=com_biblestudy&view=studydetails&id=299&templatemenuid=20&itemid=1</comments>    		<itunes:author>dale jenkins</itunes:author>  		<dc:creator>dale jenkins</dc:creator>  		<description>sunday am: dale speaks of god's grace while comparing our lives of david , mephibosheth</description>  		<content:encoded>sunday am: dale speaks of god's grace while comparing our lives of david , mephibosheth</content:encoded>  		<pubdate>sun, 26 feb 2012 11:16:03 -0500</pubdate>  		<itunes:subtitle>a place @ table</itunes:subtitle>    		<itunes:summary>sunday am: dale speaks of god's grace while comparing our lives of david , mephibosheth</itunes:summary>  		<itunes:keywords>church of christ, sermon, spring meadows</itunes:keywords>  		<itunes:duration>00:30:15</itunes:duration><enclosure url="http://www.smcoc.net/content/audio/sermons/2012/2012_2_26_a_place_at_his_table.mp3" length="12706816" type="" />  				<guid>http://www.smcoc.net/content/audio/sermons/2012/2012_2_26_a_place_at_his_table.mp3</guid><itunes:explicit>no</itunes:explicit>  	</item>
the didselectrow code:
code:
if (_webviewcontroller == nil) {               self.webviewcontroller = [[[webviewcontroller alloc] initwithnibname:@"webviewcontroller" bundle:[nsbundle mainbundle]] autorelease];           }           rssentry *entry = [_allentries objectatindex:indexpath.row];           _webviewcontroller.entry = entry;           [self.navigationcontroller pushviewcontroller:_webviewcontroller animated:yes];
however, url gets parsed of is:
code:
http://www.smcoc.net/index.php?option=com_biblestudy&view=studydetails&id=299&templatemenuid=20&itemid=1
this under <link> tag in xml. me pointed either in <enclosure> tag or <guid> tag?
 



Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment