Universal XLM reader for rss news feeds

Discussion in 'iOS Programming' started by 1458279, Apr 5, 2016.

  1. 1458279 Suspended


    May 1, 2010
    I've been digging into an RSS news feed reader. I'm running into a problem when I change from one feed to another.

    The tutorial:

    I wanted to do things like read different feeds and be able to add new ones as needed. I'm new to XML and it seems I'm having a problem with different data structures being returned.

    Is there a universal routine to read different news feeds or do you have to know the structure in advance?

    Is there a getStructureFromXML() function somewhere, so I can at least get an idea of the structure that's coming in?

    Or maybe a routine that will make an array and load it in whatever the structure is?

    BTW, theres a weak spot in the tutorial code:

    NSString* itemDescription = [NSString stringWithFormat:@"%@...", [self.itemDescription substringToIndex:100]];
    Will crash if the string is < 100, this will fix it:

       NSString* itemDescription = @"*Error* Description Too short...";
        if (self.itemDescription.length > 20)
            itemDescription = [NSStringstringWithFormat:@"%@...", [self.itemDescriptionsubstringToIndex:MIN(100,self.itemDescription.length-1)]];
  2. Dookieman macrumors 6502

    Oct 12, 2009
    In my limited experience with XML (I wrote a podcast app, podcasts feeds are just RSS Feeds), the submitters needed to conform to a structure. I'm not sure if it's the same in all cases but I assume there is an agreed upon way on setting up an RSS Feed so it can be easily read by multiple RSS programs. I would spit your XML you returned into the log and adjust your model to what is returned. I would be 9/10 times most feeds are similar.

Share This Page