Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:27:59+00:00 2026-06-09T12:27:59+00:00

Hello I am parsing a RSS And Atom feeds, and my question is how

  • 0

Hello I am parsing a RSS And Atom feeds, and my question is how can I check for < img > and < url > tags in < description >?

There must be some sort of check. Thanks.

Here is how I parse them:

- (NSArray *)parseFeed:(NSURL *)feedURL{
    NSError *error;
    NSData *data = [NSData dataWithContentsOfURL:feedURL];
    GDataXMLDocument *xmlParse = [[GDataXMLDocument alloc] initWithData:data error:&error];
    GDataXMLElement *rootElement = xmlParse.rootElement;
    NSArray *array = [[NSArray alloc] init];
    if ([rootElement.name compare:@"rss"] == NSOrderedSame) {
        array = [self parseRSSFeed:rootElement];
        return array;
    } else if ([rootElement.name compare:@"feed"] == NSOrderedSame) {
        array = [self parseAtomFeed:rootElement];
        return array;
    } else {
        NSLog(@"Unsupported root element: %@", rootElement.name);
        return nil;
    }
}

-(NSArray *)parseRSSFeed:(GDataXMLElement *) rootElement
{
    NSMutableArray *entries = [[NSMutableArray alloc] init];
    NSArray *channels = [rootElement elementsForName:@"channel"];
    for (GDataXMLElement *channel in channels) {
        NSArray *items = [channel elementsForName:@"item"];
        for (GDataXMLElement *item in items) {
            FeedItem *itemF = [[FeedItem alloc] init];
            itemF.title = [item valueForChild:@"title"];
            itemF.description = [item valueForChild:@"description"];
            NSLog(@"IMAGE - %@", [item valueForChild:@"img"]);
            itemF.dateString = [item valueForChild:@"pubDate"];
            itemF.link = [NSURL URLWithString:[item valueForChild:@"link"]];
            itemF.dateString = [item valueForChild:@"updated"];
            itemF.author = [item valueForChild:@"author"];
            [entries addObject:itemF];
            NSLog(@"RSS - %@", itemF.title);
        }
    }
    NSArray *RSSArray = [entries copy];
    return RSSArray;
}
-(NSArray *)parseAtomFeed:(GDataXMLElement *) rootElement
{
    NSMutableArray *entries = [[NSMutableArray alloc] init];
    NSArray *entry = [rootElement elementsForName:@"entry"];
    for (GDataXMLElement *entryElement in entry) {
        // NSArray *items = [channel elementsForName:@"item"];
        //for (GDataXMLElement *item in items) {
        FeedItem *itemF = [[FeedItem alloc] init];
        itemF.title = [entryElement valueForChild:@"title"];
        itemF.description = [entryElement valueForChild:@"summary"];
        NSArray *links = [entryElement elementsForName:@"link"];
        for (GDataXMLElement *link in links) {
            itemF.link = [NSURL URLWithString:[[link attributeForName:@"href"] stringValue]];
        }
        itemF.dateString = [entryElement valueForChild:@"updated"];
        NSArray *authors = [entryElement elementsForName:@"author"];
        for (GDataXMLElement *authorElement in authors) {
            itemF.author = [authorElement valueForChild:@"name"];
        }
        [entries addObject:itemF];
        NSLog(@"Atom - %@", itemF.title);
    }
    NSArray *atomArray = [entries copy];
    return atomArray;
}

I am parsing them using GDataXMLParser, and my own parser class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:28:00+00:00Added an answer on June 9, 2026 at 12:28 pm

    Do it like this:

    NSString *Str=[item valueForChild:@"description"];
    NSArray *tmp=[Str componentsSeparatedByString:@"<Img>"];
    if([tmp count]>1){
        NSString *urlstr=[[tmp objectatindex:1] stringByReplacingOccurrencesOfString:@" </Img>" withString:@""];
    }
    

    Now urlstr contains your image url.

    Enjoy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with JSON parsing. When I hit URL, I've got JSON
Please can somebody show me a simple example of parsing some HTML using libxml.
Hello I am parsing some json on android and I have been able to
Hello Android programmers, I am working on parsing a website in my application. This
I am passing the email address as part of the url, for ex. http://example.com/hello/user@hotmail.com
I have a question about type casting. I have the following JSON String: {server:clients,method:whoIs,arguments:[hello]}
Hello guys I am currently parsing all the html body for finding the document
A little new to PHP parsing here, but I can't seem to get PHP's
I want to make an app which (amongst other things) can parse feeds loaded
Hello i have trouble with parsing a pdf when the iterator reaches page 11

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.