Please help me get link html in c# -



Please help me get link html in c# -

this question has reply here:

get links on html page? 4 answers

i have next code:

<div id="list"> <table> <tr> <th>stt</th> <th>link</th> </tr> <tr> <td>line 1</td> <td><a href="http://website.com/link1">link 1</a></td> </tr> <tr> <td>line 2</td> <td><a href="http://website.com/link2">link 2</a></td> </tr> </table> </div>

how can get:

http://website.com/link1

http://website.com/link2

please help me. give thanks much !

the xpath hrefs of a elements in table in exact construction you've given:

htmldoc.documentnode.selectnodes("//div[@id='list']/table/tr[td]/td[a]/a");

and scrape out of @href attributes.

unpacked:

find div attribute id value of 'list', navigate kid table , tr rows td child, then, similarly, td elements a child.

c# html-agility-pack

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -