Note that there are some explanatory texts on larger screens.

plurals
  1. POHtmlAgility Pack is having difficulties to get information from the nested table
    primarykey
    data
    text
    <p>I am trying to parse the table below but unfortunately each of nodes seems nested each other. :( It is impossible to get the childnodes because it is always giving the count = 1</p> <p>It is really interesting but it is finding; for example the next "tr" as the childnode of the previous tr?</p> <p>Do you have any idea?</p> <pre><code>&lt;table width="292px" border="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;table&gt; &lt;tr&gt; &lt;td colspan="2" bgcolor="#FBCE9D" align="center" height="40"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#FFF4D2" height="25" width="60"&gt; &lt;/td&gt; &lt;td height="25" bgcolor="#e8e8e8"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#FFF4D2" height="25" width="60"&gt; &lt;/td&gt; &lt;td height="25" bgcolor="#e8e8e8"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#FFF4D2" height="25" width="60"&gt; &lt;/td&gt; &lt;td height="25" bgcolor="#e8e8e8"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#FFF4D2" height="25" width="60"&gt; &lt;/td&gt; &lt;td height="25" bgcolor="#e8e8e8"&gt; &lt;/td&gt; //Here is a missing "&lt;/tr&gt;" and I think this one is confusing the agilitypack! &lt;tr&gt; &lt;td bgcolor="#FFF4D2" height="35" colspan="2" align="center"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>My code is:</p> <pre><code>var webGet = new HtmlWeb(); var doc = webGet.Load("the url where this table is located"); HtmlNodeCollection tb = doc.DocumentNode.SelectNodes("//table[@width='292px']"); var table = tb[0].ChildNodes[1].ChildNodes[0].ChildNodes[0].ChildNodes; for (var na = 0; na &lt; table.Count; na++) { .....do the work.... } </code></pre> <p>Actually this code was working like a charm before but they nested another table inside it is stucking with <code>ChildNodes[1]</code> because there will be no <code>ChildNodes[1]</code> it is always <code>ChildNodes[0]</code>?</p> <p>One more note; Firebug shows "/html/body/table/tbody/tr[2]/td/table/tbody" as the XPath of the nested table but as you may notice that "tbody" is not familiar with htmlagility because it is dynamically produced by the browser to eleminate the missing close tag /tr</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload