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

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?
 
S

Sunny

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
 
H

Hasani

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top