c# - Loop out values ​​from a div tag with the xpath and html agility -


i'm trying scrape website. comparison site , in such exists div tags class several times loop out information each div tag in "div" list item:

"phone": 5432432423

"postalcode": 34234

            <div class="biz_list">             <div data-id="39856" class="heart hgraysprite sprite evt_favorite"></div>              <div class="biz_evals right string_11" style="margin-top: 15px;">              <span class="star_blanksprite sprite" title="4.5 av 5"><span class="star_wholesprite sprite rate45"></span></span>             snittkarakter 4.5<br>av 18 evalueringer              </div>             <div class="biz_info">                 <h3><a href="/profil/39856/r%c3%b8r-service/">rør service</a></h3>                 <table class="string_14">                     <tbody><tr>                        <td>postadr.:</td>                         <td class="tab_space">korssund, 6964 korssund</td>                      </tr>              <tr>                 <td>telefon:</td>                  <td class="tab_space">577 37 648</td>             </tr>              <tr>                 <td>mobil:</td>                  <td class="tab_space">992 93 595</td>             </tr>                  </tbody></table>              </div>         </div> 

my code

list<string> div = new list<string>();          foreach (htmlnode td in root.selectnodes("//div[@class='biz_info']"))         {             string att = td.innertext;             string trimaatt = att.trim();             div.add(trimaatt);           } 

can me pls!


Comments