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

  • SEARCH
  • Home
  • 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 715467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:11:26+00:00 2026-05-14T05:11:26+00:00

I’m using a RSS Reader and works fine when I tap the UITableViewCell to

  • 0

I’m using a RSS Reader and works fine when I tap the UITableViewCell to load the <link> either in a UIWebView or to open Safari on that link.

But I really want to learn how to load the Topic content into the application instead showing the entire site or jump to Safari

In the RSS feed per each <item> there is a <body> tag (and a <Description> that contains the same but encoded) that contains the topic content, like the image below shows:

alt text http://www.balexandre.com/temp/2010-04-13_0953.png

So, instead of catching the <link> I’m assigning the <body>. Problem is that it does not work correctly 🙁

for this example I only get the content until the first <br> nothing more.

  • I’m using a NSString as I would use in C#, should I use any other object, is there a better object to use on such data?
  • Should I use an UITextView to load this information (as it has scroll already) or I should use a UIWebView instead?

Thank you.


added

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{            
    //NSLog(@"found this element: %@", elementName);
    currentElement = [elementName copy];
    if ([elementName isEqualToString:@"item"]) {
        // clear out our story item caches...
        item = [[NSMutableDictionary alloc] init];
        currentTitle = [[NSMutableString alloc] init];
        currentDate = [[NSMutableString alloc] init];
        currentSummary = [[NSMutableString alloc] init];
        currentLink = [[NSMutableString alloc] init];
        currentBody = [NSMutableString new];  // added by me
        currentCreator = [NSMutableString new];  // added by me
    }       
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{     
    //NSLog(@"ended element: %@", elementName);
    if ([elementName isEqualToString:@"item"]) {
        // save values to an item, then store that item into the array...
        [item setObject:currentTitle forKey:@"title"];
        [item setObject:currentLink forKey:@"link"];
        [item setObject:currentSummary forKey:@"summary"];
        [item setObject:currentDate forKey:@"date"];
        [item setObject:currentBody forKey:@"body"]; // <----
        [item setObject:currentCreator forKey:@"dc:creator"];

        [stories addObject:[item copy]];
        NSLog(@"adding story: %@", currentTitle);
    }
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
    //NSLog(@"found characters: %@", string);
    // save the characters for the current item...
    if ([currentElement isEqualToString:@"title"]) {
        [currentTitle appendString:string];
    } else if ([currentElement isEqualToString:@"link"]) {
        [currentLink appendString:string];
    } else if ([currentElement isEqualToString:@"summary"]) {
        [currentSummary appendString:string];
    } else if ([currentElement isEqualToString:@"pubDate"]) {
        [currentDate appendString:string];
    } else if ([currentElement isEqualToString:@"body"]) {
        [currentBody appendString:string]; // <----
    } else if ([currentElement isEqualToString:@"dc:creator"]) {
        [currentCreator appendString:string];
    }
}

and to pass to my WebBrowser View I have:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic

int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];

NSString * storyContent = [[stories objectAtIndex: storyIndex] objectForKey: @"body"];

// load web view
[self showWebPage:storyContent]; // <-- Here (storyContent variable) I only have the content until the first <br> :-(
}
  • 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-05-14T05:11:26+00:00Added an answer on May 14, 2026 at 5:11 am

    Take a look at the SeismicXML sample project from Apple. It gives you a general idea of how to use NSXMLParser, and is also written to parse the XML data in its own thread to allow the user to still interact with the UI. If you are looking for a nested tag (i.e. <body> within <item>), you will want a flag to tell if you are currently within the <item> tag or not. Otherwise you will parse all <body> tags.

    To address your second question, it depends on how you want to present this information to the user. If you want the text styled, you will need to use a UIWebView. Otherwise you can strip out what you need and have that spread out through a UITableView, or a custom view you create in Interface Builder.

    Edit: After seeing your last comment, you need to create a flag (i.e. insideBody) and check for that inside of foundCharacters:

    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
        //NSLog(@"found characters: %@", string);
        // save the characters for the current item...
        if(insideBody == YES) {
            [currentBody appendString:string];
        } else if ([currentElement isEqualToString:@"title"]) {
            [currentTitle appendString:string];
        } else if ([currentElement isEqualToString:@"link"]) {
            [currentLink appendString:string];
        } else if ([currentElement isEqualToString:@"summary"]) {
            [currentSummary appendString:string];
        } else if ([currentElement isEqualToString:@"pubDate"]) {
            [currentDate appendString:string];
        } else if ([currentElement isEqualToString:@"dc:creator"]) {
            [currentCreator appendString:string];
        }
    }
    

    You will probably have to do the same in didStartElement: and didEndElement:, as getting data from foundCharacters: will only give you the content of tags and not the tags themselves.

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

Sidebar

Ask A Question

Stats

  • Questions 431k
  • Answers 431k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See answer to this question Days since 1900 or read… May 15, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer You're not going to be able to have it work… May 15, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer You need to make sure you're doing a few things:… May 15, 2026 at 2:18 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.