Created: 2012-03-26 20:28
Updated: 2016-03-16 11:12
License: mit


AFGDataXMLRequestOperation is an extension for AFNetworking that provides an interface to parse XML using GDataXML-HTML. To use this code you have to manually add GDataXML and AFNetworking to your Project

This is still in early stages of development, so proceed with caution when using this in a production application. Any bug reports, feature requests, or general feedback at this point would be greatly appreciated.

Example Usage

AFGDataXMLRequestOperation *operation = [AFGDataXMLRequestOperation XMLDocumentRequestOperationWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]] success:^(NSURLRequest *request, NSHTTPURLResponse *response, GDataXMLDocument *XMLDocument) {
      NSLog(@"XMLDocument: %@", XMLDocument);
  } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, GDataXMLDocument *XMLDocument) {
// Just start the operation on a background thread
[operation start];
// Or put it in a queue, if you want to handle many operations in a row
NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
[queue addOperation:operation];


Neither AFNetworking or GDataXML support ARC at the moment

If your code is using Automatic Reference Counting (ARC) do the following:

  1. Select Build Phases tab.

  2. Expand Compile Sources.

  3. Select each file of AFNetworking and GDataXML then press Enter.

  4. On the small input box that pops-out, enter -fno-objc-arc.


Simon Gr├Ątzer


This Code is basically a slight modification of Mattt Thompson's AFKissXMLRequestOperation (


AFGDataXMLRequestOperation is available under the MIT license. See the LICENSE file for more info.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more