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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:11:21+00:00 2026-06-04T06:11:21+00:00

I’m currently using RaptureXML to pull in data from a url tio display inside

  • 0

I’m currently using RaptureXML to pull in data from a url tio display inside a table view. I’ve managed to grab every string I need and add it to my array, as you can see below:

- (void)loadURL {

RXMLElement *rootXML = [RXMLElement elementFromURL:[NSURL URLWithString:@"http://api.somexml.com/xml"]];

NSLog(@"%@ %@", rootXML.tag, [rootXML attribute:@"totalEntries"]); 
[rootXML iterateWithRootXPath:@"//event" usingBlock:^(RXMLElement *event) {
    // NSLog(@"Event - URI: %@", [event attribute:@"uri"]);
    // NSLog(@"Event - Venue: %@", [event attribute:@"displayName"]);
    // NSLog(@"Event - Type: %@", [event attribute:@"type"]);

    [rootXML iterateWithRootXPath:@"//location" usingBlock: ^(RXMLElement *location) {
        // NSLog(@"Location - City: %@",[location attribute:@"city"]);
        // NSLog(@"Location - Latitude : %@",[location attribute:@"lat"]);
        // NSLog(@"Location - Longitude: %@",[location attribute:@"lng"]);

        [rootXML iterateWithRootXPath:@"//start" usingBlock:^(RXMLElement *start) {
            // NSLog(@"Start - Time: %@",[start attribute:@"time"]);
            // NSLog(@"Start - Date: %@",[start attribute:@"date"]);

            [rootXML iterateWithRootXPath:@"//performance" usingBlock:^(RXMLElement *performance) {
                // NSLog(@"Performance - Artist: %@",[start attribute:@"displayName"]);

                [events addObject:[NSArray arrayWithObjects:
                                   [event attribute:@"uri"],
                                   [event attribute:@"displayName"],
                                   [event attribute:@"type"],
                                   [location attribute:@"city"],
                                   [location attribute:@"lat"],
                                   [location attribute:@"lng"],
                                   [start attribute:@"time"],
                                   [start attribute:@"date"],
                                   [performance attribute:@"displayName"],
                                   nil]];                
            }];

        }];


    }];



}];

}

The problem is that when I assign the number of rows, it’s returning a large number instead of 6.

 return [events count];

This is what the XML file looks like:

<resultsPage totalEntries="6" perPage="50" page="1" status="ok">
<results>
<event uri="http://somexml.com/xml" popularity="0.863682" displayName="Radio 1's Hackney 
Weekend 2012" id="9234656" type="Festival" status="ok">
<location city="London, UK" lng="-0.128" lat="51.5078"/>
<series displayName="Radio 1's Hackney Weekend"/>
<end time="" date="2012-06-24" datetime=""/>
<start time="" date="2012-06-23" datetime=""/>
<performance displayName="Lucy Labeaux" billingIndex="5" id="23336188" billing="headline">
<artist uri="http://www.somexml.com/artistxml" displayName="Lucy Labeaux" id="1168415">
<identifier href="http://somexml.com.xml" mbid="4593d49a-7f67-46ba-9ec0-126bd676286f"/>
</artist>
</performance>

Thank you for your help!

**

Getting Error related to my array’s objects.

**

So I figured out something from constantly running the code. If you look below I add objects to my array 3 separate times.

- (void)loadURL {

RXMLElement *rootXML = [RXMLElement elementFromURL:[NSURL URLWithString:@"http://somexml.com/xml"]];

NSLog(@"%@ %@", rootXML.tag, [rootXML attribute:@"totalEntries"]);

[rootXML iterateWithRootXPath:@"//event" usingBlock:^(RXMLElement *event) {

    [events addObject:[NSArray arrayWithObjects:
                       [event attribute:@"uri"],
                       [event attribute:@"displayName"],
                       [event attribute:@"type"], nil]];
 }];

[rootXML iterateWithRootXPath:@"//location" usingBlock: ^(RXMLElement *location) {

    [events addObject:[NSArray arrayWithObjects:
                       [location attribute:@"city"],
                       [location attribute:@"lat"],
                       [location attribute:@"lng"],
                       nil]]; 
}];    

[rootXML iterateWithRootXPath:@"//start" usingBlock:^(RXMLElement *start) {

    [events addObject:[NSArray arrayWithObjects:
                       [start attribute:@"time"],
                       [start attribute:@"date"],
                       nil]]; 
}];

}

Now when I call my objects so I can link them to the interface I did the following:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
EventsCell *cell = (EventsCell *)[tableView dequeueReusableCellWithIdentifier:@"EventsCell"];

cell.venueLabel.text = [NSString stringWithFormat:@"%@",[[events objectAtIndex:indexPath.row] objectAtIndex:2]];

return cell;

}

I realized that instead of creating a total of 8 objects at index, it’s only creating 3. And everytime I add new objects it’s adding it to those 3 indexes. For example if I assign my Venue Label to the objectAtIndex 2, I not only get 6 rows with the label displaying the type, but also another 6 displaying the time.

This is how my viewDidLoad looks:

- (void)viewDidLoad
{
[super viewDidLoad];

self.events = [[NSMutableArray alloc] init];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    [self loadURL];

    dispatch_async(dispatch_get_main_queue(), ^{
        [self.tableView reloadData];
    });
});

}
  • 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-04T06:11:23+00:00Added an answer on June 4, 2026 at 6:11 am

    Seeing that no one answered the question as an “answer” but left the answer in the comments, I’m going to just accept this as the answer.

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

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters

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.