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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:22:14+00:00 2026-06-11T11:22:14+00:00

I used RestKit to load XML data from a resource. That worked perfect, but

  • 0

I used RestKit to load XML data from a resource. That worked perfect, but now I want to change my whole program to read local XML files. I found the possibility to read a local xml file and parse it through RestKit in the Google RestKit Group:

NSString *string = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"testing" ofType:@"xml"] encoding:NSUTF8StringEncoding error:nil]; 
id<RKParser> parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:RKMIMETypeXML]; 
id result = [parser objectFromString:string error:nil]; 
NSLog(@"%@",[[[[result objectForKey:@"sample"] objectForKey:@"nested"] objectForKey:@"tags" ] description]); 

But now I want to load this object with my mapping. My old code with loading from a server:

RKObjectManager *objectManager = [RKObjectManager sharedManager];
RKURL *URL = [RKURL URLWithBaseURL:[objectManager baseURL] resourcePath:[xmlFile path] queryParameters:nil];

[objectManager.mappingProvider setMapping:myMapping forKeyPath:myKeyPath];

[objectManager loadObjectsAtResourcePath:[NSString stringWithFormat:@"%@", [URL resourcePath]] usingBlock:^(RKObjectLoader *loader) {
    loader.delegate = self;
}];

After that I get my mapped objects in the didLoadObjects delegate of RestKit. How can I do the same for my local xml object?

  • 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-11T11:22:15+00:00Added an answer on June 11, 2026 at 11:22 am

    I found the following solution for the problem. Works like a charm.

    RKObjectMappingProvider* mappingProvider = [RKObjectManager sharedManager].mappingProvider;
    RKObjectMapper* mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider];
    RKObjectMappingResult* result = [mapper performMapping];
    if (result) {
    
        NSArray *resultArray = result.asCollection;
    
        MyMappingClass *object = [resultArray lastObject];
        NSLog(@"My Object: %@", object);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble with my iOS/Restkit app. It used to work fine but now
I used the phonegap website to create an IPA file. Now I want to
I am currently migrating a project that used ASIHTTPRequest and SBJson to RestKit. The
Used http://www.ilbcfreeware.org/software.html - I only get static from the files that ilbc_test.exe creates. Does
Used XStream lib, but no children XML was difficult to parse in Java. Wanting
I used var dp:ArrayCollection = new ArrayCollection(container.GetVotesResult); to get the JSON data from GetVotesResult
Never used a cache like this before. The problem is that I want to
I have a JSON response from my server. The data, taken from the RestKit
I have downloaded the latest RestKit version 0.9.3 from github and noticed that the
I have been trying to post using RestKit after I have successfully used it

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.