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 7776243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:49:56+00:00 2026-06-01T17:49:56+00:00

I am working on an iOS app that uses NSURL to consume XML data

  • 0

I am working on an iOS app that uses NSURL to consume XML data from a website: http://undignified.podbean.com/feed. From there I parse through the XML using NSXMLParser and search for an attribute called “url” within the “enclosure” element. All attributes that match “url” are then added to a Mutable array labeled _links. The problem is every time a “url” attribute is found and is added to the array, it’s adding it into the previous entry and creating essentially one big object in the array. If I NSLog out the array, _links, the following is displayed:

(
    (
    "http://undignified.podbean.com/mf/feed/hm8a2d/UndignifiedBonusShow.mp3",
    "http://undignified.podbean.com/mf/feed/cfdayc/UndignifiedShow03.mp3",
    "http://undignified.podbean.com/mf/feed/wbbpjw/UndignifiedShow02Final.mp3",
    "http://undignified.podbean.com/mf/feed/ih2x8r/UndignifiedShow01.mp3",
    "http://undignified.podbean.com/mf/feed/t4x54d/UndignifiedShow00.mp3"
    )
)

I’m using addObject for the array and have attempted insertObject, but neither have worked. My code is listed below. I know in other instances of loading objects into an array I had to implement a for loop, but am not sure if it is necessary here as the parser method appears to loop through the entire XML document by itself. I’m sure it’s something small I’m missing and a nudge in the right direction would be greatly appreciated.

UnDigParser.H – Hear file for parsing:

@interface UnDigParser : NSXMLParser <NSXMLParserDelegate> {

}
@property (retain) NSMutableArray *links;
@end

UnDigParser.M – Implementation file for parsing:

@implementation UnDigParser
NSMutableArray *_links;

@synthesize links = _links;

-(void)parserDidStartDocument:(NSXMLParser *)parser{
_links=[[NSMutableArray alloc] init];
}

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
if ([elementName isEqualToString:@"enclosure"]){

    NSString *link = [attributeDict objectForKey:@"url"];
    if (link){
        [_links addObject:link];
        }
}
NSLog(@"%@",_links);

}

-(BOOL)parse{
self.delegate = self;
return [super parse];
}

@end
  • 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-01T17:49:57+00:00Added an answer on June 1, 2026 at 5:49 pm

    I believe you built an array within an array.

    I would get rid of “NSMutableArray *_links;”

    and change “[_links addObject:link];” to “[self.links addObject:link]”

    and “_links = [[NSMutableArray alloc] init];” to “links = [[NSMutableArray alloc] init];”

    Then just use self.links when you want to refer to the links. Don’t use all of the _links to refer to it.

    How I would write it (a couple other things changed too):

    @interface UnDigParser : NSXMLParser <NSXMLParserDelegate> {
    
        NSMutableArray *links;
    
    }
    @property (nonatomic, retain) NSMutableArray *links;
    @end
    

    UnDigParser.M – Implementation file for parsing:

    @implementation UnDigParser
    
    @synthesize links;
    
    -(void)parserDidStartDocument:(NSXMLParser *)parser{
    self.links=[[NSMutableArray alloc] init];
    }
    
    -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{
    if ([elementName isEqualToString:@"enclosure"]){
    
        NSString *link = [attributeDict objectForKey:@"url"];
        if (link){
            [self.links addObject:link];
            }
    }
    NSLog(@"%@",self.links);
    
    }
    
    -(BOOL)parse{
    self.delegate = self;
    return [super parse];
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m working on an app with an AIR3 iOS native extension that uses Accelerate.framework
I have been working on a Core Data iOS app that works perfectly through
Newbie error? Im working on a quiz app that uses answer results from a
I working on a universal iOS app that gets news from an RSS feed.
I'm working on an iOS app that uses an NSTimer for a countdown. This
I'm working on an iOS project that has to work from iOS4. I have
I'm working on an app that uses a jQuery UI plugin, which in turn
I am working on an iOS app that needs to post to either Twitter,
I am working on a simple universal ios app that displays images in a
I'm working on an ios app with uitabviewcontroller that plays some music. I don't

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.