How to extract innermost table from html file with the help of the html agility pack ?

Posted by Harikrishna on Stack Overflow See other posts from Stack Overflow or by Harikrishna
Published on 2010-03-31T04:34:22Z Indexed on 2010/03/31 4:43 UTC
Read the original article Hit count: 542

Filed under:
|
|
|

I am parsing the tabular information from the html file with the help of the html agility pack.

Now I can do it and it works.

But when the table what I want to extract is inner most.

Or I don't know at which position it is in nested tables.And there can be any number of nested tables and from that I want to extract the information of the table which has column name name,address.

Ex.

<table>
       <tr><td>PHONE NO.</td><td>OTHER INFO.</td></tr>
       <tr><td>
          <table>
             <tr><td>AMOUNT</td></tr>
             <tr><td>50000</td></tr>
             <tr><td>80000</td></tr>
          </table>
       </td></tr>
       <tr><td>
          <table>
             <tr><td>
                 <table>
                     <tr><td>
                          <table>
                             <tr><td> NAME </td><td>ADDRESS</td>
                             <tr><td> ABC  </td><td> kfks   </td>
                             <tr><td> BCD  </td><td> fdsa   </td>
                          </table>
                     </tr></td>
                 </table>
             </td></tr>
          </table>
       </td></tr>
    </table>

There are many tables but I want to extract the table which has column name name,address. So what should I do ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET