I'm using GDataXMLNode
In console:
NSLog(@"%@", doc.rootElement); would produce loads of xml data in console, so source is fine.
NSLog Array is empty.
i do not understand why elementsForName @"item" is not found.
The beginning of the source looks like this
i changed elementsForName @"item" to @"channel" and i got 1 step further. i found 89 'items' within that array. however, i can't find 'descriptions'...
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 is empty");
}
In console:
NSLog(@"%@", doc.rootElement); would produce loads of xml data in console, so source is fine.
NSLog Array is empty.
i do not understand why elementsForName @"item" is not found.
The beginning of the source looks like 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 and international approaches to improvement</title>
<description><div>The latest edition of the 1000 Lives Plus e-newsletter contains news of the forthcoming national roll-out of a new early warning score to detect illness, new initiatives to reshape stroke services, and details of an international conference for 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 the patient experience through Transforming Care</title><description><div>Nurses spending more time at the bedside, improved ward environments and a significant reduction in pressure ulcers are just some of benefits patients have received thanks to the Transforming Care programme, which is being celebrated today at a 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" to @"channel" and i got 1 step further. i found 89 'items' within that array. however, i can't find 'descriptions'...
Last edited: