Parser page HTML - HtmlAgility
Bonjour à tous,
j’essaye depuis des jours de récupérer les cellules d'un tableau HTML dans un array mais malheureusement sans succès.
Ceci avec le pack HTMLAGILITY.
Si quelqu'un peut me débloquer la situation, je suis preneur.
j'utilise teste ce code pour le tableau HTML ci-dessous
mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Dim wc = New WebClient()
Dim doc = New HtmlDocument()
Using stream = wc.OpenRead("MON SITE")
doc.Load(stream)
End Using
Dim web = New HtmlWeb
For Each tble As HtmlNode In doc.DocumentNode.SelectNodes("//table")
For Each row As HtmlNode In tble.SelectNodes("./tr")
'On parcoure les cellules
For Each cell As HtmlNode In row.SelectNodes("./td")
Dim b = cell.InnerText
MsgBox(b)
Next
Next
Next |
Tableau HTML :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <table>
<thead class="partant">
<tr class="participant-header">
</td>
<td class="column-separator optional"> </td>
<td class="mode-b optional"> </td>
<td class="advanced-mode-a optional"> </td>
</tr>
</thead>
<tbody> <tr class="ligne-participant odd favorite"><td class="txtC"><strong>1</strong></td>
<td>
<span class="name unit" title="voir la fiche de CLASS CONTI">
class conti
</span>
<span class="unitRight paddingRight5">
<b class=""> </b>
<b class=""> </b>
</span>
</td>
<td class="txtC">
<td class="txtC"><b class="SANS_OEILLERES"> </b></td>
<td class="txtC">H</td>
<td class="txtC">3</td>
<td>
<span title="J.REVELEY">j.reveley</span>
</td>
<td class="txtC">70</td>
<td class="txtC">-</td>
<td class="txtC">-</td>
<td><span title="G.MACAIRE (S)">g.macaire (s)</span></td>
<td class="txtC">
<span title="1h">
1h
</span>
</td>
<td class="txtC rapport-probable">2,3</td>
<td class="txtC rapport-probable last">1,8</td>
<td class="column-separator optional"></td>
<td class="txtC mode-b optional">
<div id="participant-base-1" class="participant-selector">
<b data-type="base" class="participant-check base"> </b>
</div>
</td>
<td class="txtC advanced-mode-a optional">
<div id="participant-associate-1" class="participant-selector">
<b data-type="associate" class="participant-check associate"> </b>
</div>
</td>
</tr><tr class="ligne-participant even"><td class="txtC"><strong>2</strong></td>
<td>
<span class="name unit" title="voir la fiche de COURVITE">
courvite
</span>
<span class="unitRight paddingRight5">
<b class=""> </b>
<b class=""> </b>
</span>
</td>
<td class="txtC">
</td>
<td class="txtC"><b class="SANS_OEILLERES"> </b></td>
<td class="txtC">H</td>
<td class="txtC">3</td>
<td>
<span title="A.CHITRAY">a.chitray</span>
</td>
<td class="txtC">68</td>
<td class="txtC">-</td>
<td class="txtC">-</td>
<td><span title="G.CHEREL">g.cherel</span></td>
<td class="txtC">
<span title="2h6p9p">
2h6p9p
</span>
</td>
<td class="txtC rapport-probable">5,8</td>
<td class="txtC rapport-probable last">8,6</td>
<td class="column-separator optional"></td>
<td class="txtC mode-b optional">
<div id="participant-base-2" class="participant-selector">
<b data-type="base" class="participant-check base"> </b>
</div>
</td>
<td class="txtC advanced-mode-a optional">
<div id="participant-associate-2" class="participant-selector">
<b data-type="associate" class="participant-check associate"> </b>
</div>
</td>
</tr><tr class="ligne-participant odd"><td class="txtC"><strong>3</strong></td>
<td>
<span class="name unit" title="voir la fiche de SAINT XAVIER">
saint xavier
</span>
<span class="unitRight paddingRight5">
<b class=""> </b>
<b class=""> </b>
A
</span>
</td>
<td class="txtC">
</td>
<td class="txtC"><b class="SANS_OEILLERES"> </b></td>
<td class="txtC">H</td>
<td class="txtC">3</td>
<td>
<span title="S.COLAS">s.colas</span>
</td>
<td class="txtC">68</td>
<td class="txtC">-</td>
<td class="txtC">-</td>
<td><span title="E.CLAYEUX (S)">e.clayeux (s)</span></td>
<td class="txtC">
<span title="6h3h">
6h3h
</span>
</td>
<td class="txtC rapport-probable">8,3</td>
<td class="txtC rapport-probable last">9,2</td>
<td class="column-separator optional"></td>
<td class="txtC mode-b optional">
<div id="participant-base-3" class="participant-selector">
<b data-type="base" class="participant-check base"> </b>
</div>
</td>
<td class="txtC advanced-mode-a optional">
<div id="participant-base-13" class="participant-selector">
<b data-type="base" class="participant-check base"> </b>
</div>
</td>
<td class="txtC advanced-mode-a optional">
<div id="participant-associate-13" class="participant-selector">
<b data-type="associate" class="participant-check associate"> </b>
</div>
</td>
</tr></tbody>
</table> |