I'm trying to get the title tag of an HTML, and am using Hpple to parse the HTML. For some reason, I'm getting null when i use this code
NSURL *Url = self.webview.request.URL;
NSData *HtmlData = [NSData dataWithContentsOfURL:Url];
TFHpple *Parser = [TFHpple hppleWithHTMLData:HtmlData];
NSString *XpathQueryString = @"//head/title";
NSArray *Nodes = [Parser searchWithXPathQuery:XpathQueryString];
self.textfield.text = [NSString stringWithFormat:@"%@|%@", [[[[Nodes objectAtIndex:0] objectForKey:@"nodeChildArray"] objectAtIndex:0] objectForKey:@"nodeContent"], [Url absoluteString]];
when i log the array [Nodes objectAtIndex:0]
I get
{
nodeChildArray = (
{
nodeContent = Google;
nodeName = text;
}
);
nodeName = title;
}