Dan
Dan

Reputation: 1729

Extract part of HTML in C/Objective-C

I need to extract the detail content of a website while preserve all formatting of the division. The section I wish to extract is:

...
<div class="detailContent"><p>
<P dir=ltr><STRONG>Hinweis</strong>: Auf ... </p>
</div> 
...

My current solution is to use HTMLParser from libxml2 and xpath to find the nodes and walk through all the nodes to reconstruct this piece of HTML. This is a long an complicated code.

I' just wondering if there is an easier solution to extract part of HTML?

Thanks.

Upvotes: 0

Views: 642

Answers (1)

Chuck
Chuck

Reputation: 237010

Simple Javascript solution: document.getElementsByClassName("detailContent")

Combine that with UIWebView's support for running Javascript and you might have a more concise solution.

Upvotes: 2

Related Questions