c# - Read data in string from begin to end -


<td valign="top" class="m92_h_bigimg">     <a href="#pagetop" onclick="drop1('hotelinfos');" title="hotelinformationen einblenden"><img border=0 src="http://i2.giatamedia.de/s.php?uid=168846&source=xml&size=320&vea=5vf&cid=2492&file=007399_8790757.jpg" name="bigpic"></a> </td> <td valign="top" class="m92_h_bigimg2">     <table border=0 cellpadding=0 cellspacing=0>         <tr>           <td valign="top" class="m92_h_para">hotel:</td>           <td valign="top" class="m92_h_name">                 melia tropical              <br>                 <img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 width=13 alt="*"><img src="/images/star.gif" height=13 width=13 alt="*">                          </td>       </tr>         <tr>           <td valign="top" class="m92_h_para">zimmer:</td>             <td valign="top" class="m92_h_wert"><b>suite</b></td>       </tr>         <tr>           <td valign="top" class="m92_h_para">verpflegung:</td>           <td valign="top" class="m92_h_wert"><b>all inclusive</b></td>       </tr>       <tr>           <td valign="top" class="m92_h_para">ort:</td>             <td valign="top" class="m92_h_wert">punta cana</td>       </tr>         <tr>           <td valign="top" class="m92_h_para">region:</td>           <td valign="top" class="m92_h_wert">punta cana</td>       </tr>         <tr>             <td valign="top" class="m92_h_para">land:</td>           <td valign="top" class="m92_h_wert">dom. republik</td>         </tr>         <tr>           <td valign="top" class="m92_h_para">anbieter:</td>           <td valign="top" class="m92_h_wert"><a href="javascript:va('5vf');"><img border=0 src="http://www.lmweb.net/lmi/va/gifs/5vf.gif" alt="5 vor flug" title="5 vor flug"></a><br>5 vor flug</td>       </tr>     </table>     <table border=0 cellpadding=0 cellspacing=0>         <tr>           <td><img src="/images/dropleftw.gif" height="16" width="18"></td>             <td>                 <div id="mark" class="m92_notice">                          &nbsp;<a target="vakanz" href="siteplus/reminder.php?session_id=rslr1ejntpmj07n0f2smqfhsj5&rec=147203&m_flag=1&m_typ=hotel">dieses hotel merken</a>         </div>           </td>       </tr>       <tr>           <td><img src="/images/dropleftw.gif" height="16" width="18"></td>             <td>             <div class="m92_notice">             &nbsp;<a href="#pagetop" onclick="drop1('hotelinfos'); drop1('hoteltermine');">hotelbewertung anzeigen</a>             </div>           </td>       </tr>     </table> </td> 

with htmlagility-pack, how can data between <td valign="top" class="m92_h_bigimg"> , closing <td>. tried code not using htmlagility-pack , works found first </td> , closed. code not correct. read htmlagility-pack best solution kind of problems.

public static string[] getstringinbetween(string strbegin, string strend, string strsource, bool includebegin, bool includeend) {     string[] result = { "", "" };     int iindexofbegin = strsource.indexof(strbegin, stringcomparison.ordinal);      if (iindexofbegin != -1)     {         int iend = strsource.indexof(strend, iindexofbegin, stringcomparison.ordinal);          if (iend != -1)         {             result[0] = strsource.substring(iindexofbegin + (includebegin ? 0 : strbegin.length), iend + (includeend ? strend.length : 0) - iindexofbegin);              if (iend + strend.length < strsource.length)                         result[1] = strsource.substring(iend + strend.length);         }     }     return result; } 

how can this?

htmlagilitypack.htmldocument htmldoc = new htmlagilitypack.htmldocument(); htmldoc.loadhtml(html); var str = htmldoc.documentnode     .descendants("td")     .where(x => x.attributes["class"] != null && x.attributes["class"].value == "m92_h_bigimg")     .select(x => x.innerhtml)     .first(); 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -