Questions tagged [tfhpple]

Hpple: A nice Objective-C wrapper on the XPathQuery library for parsing HTML.

Hpple: A nice Objective-C wrapper on the XPathQuery library for parsing HTML.

FEATURES Easy searching by XPath (CSS selectors are planned) Parses HTML (XML coming soon) Easy access to tag content, name, and attributes. INSTALLATION Open your XCode project and the Hpple project. Drag the "Hpple" directory to your project. Add the libxml2.2.dylib framework to your project and search paths as described at Cocoa with Love More documentation and short screencast coming soon...

USAGE See TFHppleHTMLTest.m in the Hpple project for samples.

#import "TFHpple.h"

NSData  * data      = [NSData dataWithContentsOfFile:@"index.html"];

TFHpple * doc       = [[TFHpple alloc] initWithHTMLData:data];
NSArray * elements  = [doc search:@"//a[@class='sponsor']"];

TFHppleElement * element = [elements objectAtIndex:0];
[e text];                       // The text inside the HTML element (the content of the first text node)
[e tagName];                    // "a"
[e attributes];                 // NSDictionary of href, class, id, etc.
[e objectForKey:@"href"];       // Easy access to single attribute
[e firstChildWithTagName:@"b"]; // The first "b" child node
27 questions
7
votes
3 answers

Parse HTML in objective C

I've to parse an Html for my iOS app. I read on the web that I should use the Xpath and I found the library TFHpple. I see that this library uses the XpathQuery
lucgian84
  • 833
  • 4
  • 11
  • 29
2
votes
0 answers

HTML parsing in iOS using Hpple search href

I want to find url links in html source code. I am using Hpple for parsing the HTML. I know by giving the path we will find the url in html. For different url's the path must be changed. So i am unable to search url links. Let me explain clearly.…
vishnu
  • 715
  • 9
  • 20
1
vote
0 answers

TFHpple XPath query with function on iOS

I want to parse html to get tag attribute, but I want to change the value of that attribute using substring function. I'm using libxml2.2.tdb framework with TFHpple addon HTML to parse:
What I want to…
1
vote
1 answer

How to change attribute in HTML using TFHpple in Swift

I got a HTML string and want to change the element inside of them, in img tag style to width = 100% and height auto, so that when I pass them into the web view, the image can fit to the super view layout. HTML \"\"…</div
Edward Chiang
  • 1,133
  • 2
  • 12
  • 24
1
vote
2 answers

Getting first level using TFHpple

I have some trouble using TFHpple, so here it is : I would like to parse the following lines :
Hugues Duvillier
  • 487
  • 6
  • 12
1
vote
1 answer

encoding error : input conversion failed due to input error when using tfhpple

NSData *htmlData=[html dataUsingEncoding:NSUTF8StringEncoding]; TFHpple *htmlParser=[TFHpple hppleWithHTMLData:htmlData]; NSString *threadListXpathQuertString=@"//div[@id='postlist']/div"; NSLog(@"%@",threadListXpathQuertString); NSArray…
leizh007
  • 33
  • 4
1
vote
1 answer

Parse xml in Xcode with Hpple

I have some xml that looks like this: Plain Bagel
iqueqiorio
  • 1,149
  • 2
  • 35
  • 78
1
vote
2 answers

iOS html/xml parsing google shopping results with TFHpple

is there any way to parsing google shopping results using TFHpple without using google API (deprecated) but simple using url like for example this: https://www.google.com/search?hl=en&tbm=shop&q=AudiR8 ? I've tried many types of tags: ... myCar =…
Alessandro Ornano
  • 34,887
  • 11
  • 106
  • 133
1
vote
3 answers

NSLog string is fine but string into UITextView causes exception

So I have a view controller and in the viewdidload method it's supposed to load some content from a webpage (just a proof of concept, it'll be cached eventually). It gets the content using the tfhipple library and puts the contents into an array, it…
Compy
  • 1,157
  • 1
  • 12
  • 24
0
votes
1 answer

How to extract "meta[content$=.mp4]/content" from html document in ios?

I'm using hpple library for parsing HTML document.I want to extract .mp4 link and image link for video urls. Html tag looks like this:
sarita
  • 236
  • 1
  • 11
0
votes
1 answer

XPath Expression not working/incorrect TFHpple SWIFT 1.2

I am wondering if you could help me out. I am trying to use TFHpple to parse HTML data using Swift 1.2, but I am having issues working out the XPath expression. I am getting the following…
Bobby
  • 11
  • 5
0
votes
1 answer

Xpath getting multiple img's in div

I'm working with TFHpple and I would like to get all of the image url's in a single div tag, the number of images can very so it would need to be dynamic. Here is the HTML
Matt Sarabyte
  • 245
  • 1
  • 3
  • 10
0
votes
2 answers

Parsing a web page with TFHpple

I'm trying to write a very simple iOS app that will parse a webpage (http://arxiv.org/list/cond-mat/recent) and display a simplified version of it. I chose to use TFHpple to parse this page. I want to get titles of papers and display them in the…
Petr Stepanov
  • 71
  • 2
  • 9
0
votes
0 answers

Send POST request in Objective-C

I need to send a POST request to a website to load more results of the page (There is about 200 results that I want to parse (using TFHpple) but the page is showing just 40 and you need to click "Show More Results" at the button to load more (there…
Yhper
  • 183
  • 2
  • 14
0
votes
0 answers

not able to extract links from the following html

I need to grab the link from certain link to perform crawling however I can't extract the link from the html no matter how many time I rewrite the xpath. Hence, I'm not able to find a way to extract the link from it. Please give some suggestion to…
1
2