c# - HTMLAgilityPack XPath Expression not fetching all nodes -


Scope I'm trying to parse. For those who are not familiar with Portuguese, this page includes all topics of a certain course (University Course) grouped by "semester".

Thus, every time you "7º Peroodo Ideal", you can understand the "topic of the 7th semester".

Problem I am using an XPath expression to get all the table rows from the table with those table rows. / P>

  XPath used: // table [@ cellspacing = 2] // tr C # statement: htmlMap.DocumentNode.SelectNodes ("// table [@ cellspacing = 2] // tr"); In the HtmlNodeCollection obtained by this C # statement, only this table contains table row nodes with the  EAD0648 Gerência de Produtos / Serviços e Mercados , correct  5º Parado IDEAL  With one after the other.  

This XPath "works", but I get all the trs (as it is expected), and this is not what I want

The amount of recovered nodes? Am I missing something?

Thank you in advance

I have encountered in this past, if the table If it does not get well then there are issues of this happening, I took a very quick look at the HTML for the page and I think that probably looks like a problem, on line 2785, a & lt; / Tr & gt; then open without any & lt; Tr & gt; ; In line 2796 another & lt; / Tr & gt; .

I believe that I have not done enough verification to investigate, but seeing this, the opening . I checked it immediately because as I mentioned that I had to face this exact issue with pages with distorted tables.

Comments