2010-01-19 39 views
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&nbsp; 
      </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">&nbsp;</td> 

     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-01-30&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-02-05&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-02-06&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-02-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-03-27&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-04-03&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-01&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-08&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-18&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-22&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-22&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-29&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-05-29&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-06-02&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-06-12&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-07-02&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-07-03&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-07-07&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-08-04&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-08-15&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-08-21&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-08-28&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 

    <table width="100%" border="0" cellspacing="0"> 
     <tr> 
     <td width="100" valign="top" ><font size="2" face="Verdana">2010-09-01&nbsp; 
      </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">&nbsp;</td> 
     </tr> 
    </table> 


    </left> 
+0

顯示

所有26個元素請與根元素。 – Younes2010-01-19 09:18:43

+0

它甚至不寫他們在正確的順序? – 2010-01-19 09:25:40

回答

4

你正在選擇一個Singlenode,這就是爲什麼你只能得到一個元素;)。

獲取更多節點:

SelectNode而不是SelectSingleNode。

+0

Doh :)但仍然沒有得到儘可能多的結果,我得到的結果是,我得到了6張表,但它大約是24 – 2010-01-19 09:13:41

+0

這些元素是否劃分爲多個「」? – Younes 2010-01-19 09:15:17

+0

沒有一個,這就是讓我困惑的東西 – 2010-01-19 09:18:12

相關問題