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
0
votes
1 answer

Why am I not getting any data after Parsing this HTML data using TFHpple

I am struggling to get any information back from my xPathQuery. The link I got using Chrome's developer tools, and did it by right clicking on the highlighted row in the screenshot attached. I'm creating a recipe-based app and am just playing around…
Jamie Baker
  • 157
  • 6
0
votes
1 answer

Parsing HTML code of a page, contained in an JSON key-value pair with TFHpple in iOS

I'm making a native iOS app of my team's project using it's API. API has three main methods: to get user's profile information, his diary and certificate table. Last method returns to me JSON data with HTML code of a table. It looks like…
khabiroff
  • 240
  • 1
  • 11
0
votes
0 answers

How to parse

I have a html file that has something similar to
How do I parse it to fetch element1, elemnet2 and element3? I am using Hpple for iOS. I am using query like NSString *elementsXpathQueryString =…
iOSDev
  • 3,617
  • 10
  • 51
  • 91
0
votes
1 answer

How to get text content within a tag using TFHpple?

I have a html content something likes this.
WINDOW
DOOR
I want to extract the text content in div tag.For this sample, I would like to get text WINDOW\nDOOR. So I wrote code…
Cao Dongping
  • 969
  • 1
  • 12
  • 29
0
votes
1 answer

Objective C - scraping a webpage for Title, Description and list of URL for all images and their sizes

I'm trying to use TFHpple to scrape webpages , but I don't know the syntax for searchWithXPathQuery I need to get the Title, description , and a list of images from an arbitrary webpage, The code currently is similar to NSData * data = …
Avba
  • 14,822
  • 20
  • 92
  • 192
0
votes
2 answers

Parsing HTML content

I am parsing the link http://feedproxy.google.com/~r/NDTV-Tech/~3/YNW1kE-FDv0/story01.htm to get the contents from 'HeadContent_FullstoryCtrl_fulldetails' HTML tag. I am using TFHpple and pointing xpath parser to the HTML element using…
user2071152
  • 1,161
  • 1
  • 11
  • 25
0
votes
1 answer

Parsing HTML with TFHpple on iOS

I am working on an iOS project and my goal is to create a "pretty" app version of a specific website. To do this, I'm parsing all the data from said website with TFHpple for use in my app. This website has a store, so my goal was to read the…
MrDiddly
  • 53
  • 5
0
votes
1 answer

libxml2 XML DOM Parsing with XPathQuery

I try to parse following XML file: Aabach - Hitzkirch 11.11.2013 18:00 2.02 1.93
0
votes
1 answer

Open url in Detailview

I'm using tfhpple to parse a HTML page. I am parsing this part :
  • I am displaying it in a…
  • Romano Vacca
    • 305
    • 1
    • 4
    • 11
    0
    votes
    2 answers

    TFHpple - getting element HTML without element's tags?

    I'm parsing some HTML and I need to get all the innerHTML of . I'm doing it this way: TFHpple *doc = [[TFHpple alloc] initWithHTMLData:[NSData dataWithContentsOfFile:sectionFilePath]]; TFHppleElement *body = [doc…
    mattsven
    • 22,305
    • 11
    • 68
    • 104
    -2
    votes
    1 answer

    Convert html parser with multiple divs from swift to android using Jsoup

    I am trying to convert iOS application into android. But I just start learning Java a few days ago. I'm trying to get a value from a tag inside html. Here is my swift code: if let url = NSURL(string: "http://www.example.com/") { let…
    -2
    votes
    1 answer

    Send a POST request 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). I…
    Yhper
    • 183
    • 2
    • 14
    1
    2