can someone help me out here w/ MSHTML in c#?

  • Thread starter Thread starter Hasani
  • Start date Start date
H

Hasani

When I parse this page, I manually count 27 tables, but MSHTML only reports
9.
Here's my code
HTMLDocumentClass htmlDoc = new HTMLDocumentClass();
System.Runtime.InteropServices.UCOMIPersistFile tempFile =
(System.Runtime.InteropServices.UCOMIPersistFile)htmlDoc;
tempFile.Load(@"C:\nestedtables.html", 0);
while(htmlDoc.body == null)
System.Windows.Forms.Application.DoEvents();
htmlDoc = LoadHtml(@"C:\nestedtables.html");
IHTMLElementCollection tables = htmlDoc.getElementsByTagName("TABLE");
//tables.length shows up as 9.
// The nestedtables.html is also here
http://www.skidmore.edu/~h_blackw/nestedtables.htm

Do I have to do something special to parse nested tables?
 
Yes you have to check every table if it contains another table/tables. Every
table is an element, which may contain, or be hosted in other element. What
you are doing is to count child tables of the document element.
Sunny
 
oh, how right you are
Thx!
:)
Sunny said:
Yes you have to check every table if it contains another table/tables. Every
table is an element, which may contain, or be hosted in other element. What
you are doing is to count child tables of the document element.
Sunny
 
Back
Top