1
嗨,我正在通過一個HTML字符串與HtmlAgilityPack。現在我需要在tag之間獲得所有內容。它看起來像這樣。HtmlAgilityPack表達式得到這個?
<left>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
<table>..</table>
</left>
現在我用這個表達式來完成這個任務。 編輯:
var htmlResult = doc.DocumentNode.SelectNodes("//left");
foreach (var item in htmlResult)
{
litStatus.Text += item.InnerHtml;
}
我只得到了6首,但有大約24臺。爲什麼,有什麼想法?
<left>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-01-29
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Årets första Rockabillyfest på Carinas!!! Vänersborg</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2827'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Swapmeet, Karlstad</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2824'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Vintermarknad, Emmaboda</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2790'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Rock`n Roll Party, Göteborg</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2803'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Rockabilly fest Kungälv</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2784'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-02-05
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Countrykväll med WOODSTATE, Säter</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2830'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-02-06
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">House of Blues, Oskarshamn</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2837'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Rock`n Roll Party, Göteborg</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2833'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Vårrock, Varekil</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2831'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">ROCK´N´ROLL SHOW TROLLHÄTTAN</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2825'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Bilutstälnning mitt i Tärnsjö m crusing</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2787'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">ROCKABILLY NIGHT, Blomstermåla</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2832'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Grillfesten, Karlskoga</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2838'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-04-03
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">WHEELERS PÅSKFEST</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2769'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-01
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">WHEELERS CRUISING, VETLANDA</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2774'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-08
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Örebro springmeet no:4</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2836'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-18
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">TISDAGSTRÄFF I SÄTERDALEN</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2829'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-22
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">KRISTINEHAMNS TRÄFFEN, Kristinehamn</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2834'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-22
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Söderhamns Cruising, Söderhamn</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2835'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-29
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Sollefteå big meet</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2788'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-05-29
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">May Graduation 2010, Göteborg</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2826'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-06-02
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Åkdon & Termos, Hudiksvall</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2761'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-06-12
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Nostalgifest i Pilaboparken, Nässjö</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2839'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-07-02
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">FALQVISTS GLAS TROOPHY 2010, KARLSKOGA</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2791'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-07-03
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Pistohiekka Rock n roll&Cruise, Finland</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2802'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-07-07
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Åkdon & Termos, Hudiksvall</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2764'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-08-04
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Åkdon & Termos, Hudiksvall</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2763'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-08-15
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Classic Wing Meet 2010, Gullspång 13-15 aug</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2823'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-08-21
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">FORDONSUTSTÄLLNING, Skövde</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2828'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-08-28
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">GÖTEBORGSCRUISINGEN</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2822'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="100" valign="top" ><font size="2" face="Verdana">2010-09-01
</font> </td>
<td valign="top" width="342" >
<div align="left"><font size="2" face="Verdana">Åkdon & Termos, Hudiksvall</font> <font size='2' face='Verdana'><A HREF='kalender_detalj.asp?ID=2762'>Mer info!</A></font></div>
</td>
</tr>
<tr>
<td style="Font-size: 1pt" face="Verdana" width="100"> </td>
</tr>
</table>
</left>
顯示所有26個元素請與根元素。 –
Younes
2010-01-19 09:18:43
+0
A
4
+0
+0
+0
相關問題
-
1. 正則表達式得到一個表
-
2. HTMLAgilityPack表達式不能包含lambda表達式
-
3. XPath表達式匹配的HtmlAgilityPack
-
4. 轉換正則表達式來htmlagilitypack
-
5. 需要幫助得到這個正則表達式正確
-
6. 如何得到這個正則表達式匹配</span>
-
7. 我不能得到這個正則表達式正常工作
-
8. 正則表達式匹配後得到這個單詞
-
9. 似乎無法得到這個正則表達式下來
-
10. 無法得到這個正則表達式 - \ [pbrc:tl:[^]] * ad * \] - 工作?
-
11. 問題得到分析這個正則表達式
-
12. HTMLAgilityPack得到AJAX值
-
13. OGNL表達式得到ACSIdx
-
14. LINQ表達式和這個
-
15. 我如何把這些AngularJS表達式到這個特定表
-
16. 將這兩個表達式組合成單個LINQ表達式
-
17. 如何爲這個表達式寫一個正則表達式?
-
18. 是這個postgres正則表達式相當於這個表達式嗎?
-
19. 這個模式的正則表達式
-
20. 正則表達式,該表達式或如何拆分這個表達式
-
21. 這個表達式的正則表達式'PI-1234-265K'
-
22. 什麼是MySQL的SQL正則表達式這個表達式
-
23. 正則表達式 - 請在形成這個表達式
-
24. 如何獲得這個表達式值model => model.Name?
-
25. 如何獲得這個綁定表達式?
-
26. 這個lambda表達式可以變得更簡單嗎?
-
27. 如何用正則表達式獲得這個substr?
-
28. 這個正則表達式可以做得更好嗎?
-
29. 不能獲得(顯示)從這個表達式
-
30. 爲什麼這個XPath表達式獲得太多數據?
最新問題
-
1. 通過全局變量遍歷()字典
-
2. 爲什麼Web元素只在一個列表中的一個元素?
-
3. 重定向與被迫小寫字母來識別文件名
-
4. html-webpack-plugin如何與html-loader一起使用?
-
5. 如何從gridview設置onClick圖像?
-
6. 實施ReactJS成角應用
-
7. 如何編輯kendogrid的pageSize的使100在1-10這個改變顏色,點擊執行功能
-
8. JavaFX 8:FXML的重用
-
9. C中ICMPv6校驗和計算返回錯誤結果
-
10. Array.Filter和找不到錯誤角度4
-
1. 正則表達式得到一個表
-
2. HTMLAgilityPack表達式不能包含lambda表達式
-
3. XPath表達式匹配的HtmlAgilityPack
-
4. 轉換正則表達式來htmlagilitypack
-
5. 需要幫助得到這個正則表達式正確
-
6. 如何得到這個正則表達式匹配</span>
-
7. 我不能得到這個正則表達式正常工作
-
8. 正則表達式匹配後得到這個單詞
-
9. 似乎無法得到這個正則表達式下來
-
10. 無法得到這個正則表達式 - \ [pbrc:tl:[^]] * ad * \] - 工作?
它甚至不寫他們在正確的順序? – 2010-01-19 09:25:40
回答
你正在選擇一個Singlenode,這就是爲什麼你只能得到一個元素;)。
獲取更多節點:
SelectNode而不是SelectSingleNode。
來源
2010-01-19 09:09:13 Younes
Doh :)但仍然沒有得到儘可能多的結果,我得到的結果是,我得到了6張表,但它大約是24 – 2010-01-19 09:13:41
這些元素是否劃分爲多個「」? – Younes 2010-01-19 09:15:17
沒有一個,這就是讓我困惑的東西 – 2010-01-19 09:18:12
相關問題