Home  >  Article  >  Web Front-end  >  Detailed graphic explanation of how to use TFHpple to parse HTML

Detailed graphic explanation of how to use TFHpple to parse HTML

高洛峰
高洛峰Original
2017-03-30 09:31:462453browse

Use TFHpple to parse html

Detailed graphic explanation of how to use TFHpple to parse HTML

Preparatory work

Introduce static library files
Detailed graphic explanation of how to use TFHpple to parse HTML

Add the header search paths of the library file (note, All must be selected)

Detailed graphic explanation of how to use TFHpple to parse HTML

Drag the source code package downloaded from github into the project

Detailed graphic explanation of how to use TFHpple to parse HTML

End of preparation

Usage details

Let’s parse the title tag in the URL.

Detailed graphic explanation of how to use TFHpple to parse HTML

The idea is like this:

1. Convert the web page into NSData

2. Query the data in NSData according to the tag value

3. Retrieve the desired data

Detailed graphic explanation of how to use TFHpple to parse HTML

Print information is as follows:

2014-05-16 11:34:19.227 Html[ 3736:60b]

You Xianming - Blog Garden
2014-05-16 11:34:19.230 Html[3736:60b] You Xianming - Blog Garden

Let’s come The parsing is more complex, such as parsing out all the summary information in the web page.

Detailed graphic explanation of how to use TFHpple to parse HTML

Detailed graphic explanation of how to use TFHpple to parse HTML


##Come again Test CSDN's:

Detailed graphic explanation of how to use TFHpple to parse HTML

As long as you can distinguish clearly:

Node

Node attributes

Node attribute value

Node content

The rest is easy!

so easy!

The above is the detailed content of Detailed graphic explanation of how to use TFHpple to parse HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn