Saturday, 22 February 2014

GDataXML parsing error


i'm using gdataxmlnode

code:
nsurl *newsfeed = [[nsurl alloc] initwithstring:@"http://www.1000livesplus.wales.nhs.uk/rss"];     nsdata *xmldata = [[nsmutabledata alloc] initwithcontentsofurl:newsfeed];     nserror *error;     gdataxmldocument *doc = [[gdataxmldocument alloc] initwithdata:xmldata options:0 error:&error];     if (doc == nil) { return nil; }          //nslog(@"%@", doc.rootelement);     news *news = [[news alloc] init];     nsarray *extractedarticles = [doc.rootelement elementsforname:@"item"];          if (extractedarticles.count > 0) {         nslog(@"array contains something");     } else {         nslog(@"array empty");     }
in console:
nslog(@"%@", doc.rootelement); produce loads of xml data in console, source fine.

nslog array empty.

not understand why elementsforname @"item" not found.

beginning of source looks this

code:
2012-03-31 21:31:50.208 gdataxmlexperiment[444:f803] gdataxmlelement 0x6b2c4a0: {type:1 name:rss xml:"<rss version="2.0"><channel>  <title>1000 lives plus: latest news</title><link>http://www.1000livesplus.wales.nhs.uk/</link> <description>latest news</description> <language>en-gb</language> <copyright>copyright nhs wales 2012</copyright> <webmaster>webteam@wales.nhs.uk</webmaster> <docs>http://www.infoworld.com/rss/rss_info.html</docs> <lastbuilddate>sat, 31 mar 2012 21:31:48 gmt</lastbuilddate>  <item> <title>national , international approaches improvement</title> <description><div>the latest edition of 1000 lives plus e-newsletter contains news of forthcoming national roll-out of new warning score detect illness, new initiatives reshape stroke services, , details of international conference healthcare students.</div></description> <link>http://www.wales.nhs.uk/sitesplus/1011/news/22137</link> <pubdate>mon, 12 mar 2012 09:47:37 gmt</pubdate><source url="http://www.1000livesplus.wales.nhs.uk/">1000 lives plus</source> </item>  <item><title>improving patient experience through transforming care</title><description><div>nurses spending more time @ bedside, improved ward environments , significant reduction in pressure ulcers of benefits patients have received transforming care programme, being celebrated today @ special event in cardiff.</div></description><link>http://www.wales.nhs.uk/sitesplus/1011/news/22080</link><pubdate>wed, 07 mar 2012 11:05:28 gmt</pubdate><source url="http://www.1000livesplus.wales.nhs.uk/">1000 lives plus</source></item><item><title>new whit
i changed elementsforname @"item" @"channel" , got 1 step further. found 89 'items' within array. however, can't find 'descriptions'...
 

i figured out now. had extract items array, , perform fast enumeration on array.
 


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