Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nashyo

macrumors 6502
Original poster
Oct 1, 2010
299
0
Bristol
I'm dying inside. I have been working for literally days and I'm getting no where.

The following code works fine and the response string shows up in the debugging panel, but I have no idea how to step through the text/html that returns as a responseString (or responseData).

I'm begging for help. Can someone help me parse html please?

Code:
-(MKNetworkOperation*)jobSearchWithGrade:(NSString*)theGrade withSpecialty:(NSString*)theSpeciality withLocation:(NSString*)theLocation
{
    MKNetworkOperation *op = [self operationWithPath:@"/doctor-jobs/anaesthetics-153/" params:nil httpMethod:@"GET"];
    
    [op onCompletion:^(MKNetworkOperation *completedOperation) {
        NSLog(@"Response: %@", [completedOperation responseString]);
                        
        // do processing here

    }onError:^(NSError *error){
        //NSLog(@"failure");
        
        //errorBlock(error);
    }];
    
    [self enqueueOperation:op];
    
    return op;
}
 
It will be great if you can post response headers and the response itself.

Also, you will look at the response headers only to check for success/failure. The actual response you are looking for will be in responseData. You can convert it to a string using initWithData:encoding of NSString.
 
It will be great if you can post response headers and the response itself.

Also, you will look at the response headers only to check for success/failure. The actual response you are looking for will be in responseData. You can convert it to a string using initWithData:encoding of NSString.

I found TFHpple and this sorted my problem out.
https://github.com/topfunky/hpple

I thought I would never find good thrid party code for this task, but I can say this works for me.

I can access the elements using this. Now I need to become more familiar with XPath to understand how to delve into nodes.

Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.