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.
AFGDataXMLRequestOperation *operation = [AFGDataXMLRequestOperation XMLDocumentRequestOperationWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://legalindexes.indoff.com/sitemap.xml"]] success:^(NSURLRequest *request, NSHTTPURLResponse *response, GDataXMLDocument *XMLDocument) {
NSLog(@"XMLDocument: %@", XMLDocument);
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, GDataXMLDocument *XMLDocument) {
NSLog(@"Failure!");
}];
// 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];
-
Select Build Phases tab.
-
Expand Compile Sources.
-
Select each file of AFNetworking and GDataXML then press Enter.
-
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 (https://github.com/AFNetworking/AFKissXMLRequestOperation)
AFGDataXMLRequestOperation is available under the MIT license. See the LICENSE file for more info.