tags:

views:

1328

answers:

1

I am using the mshtml namespace to access DOM elements as returned by a COM Browser object.

My code is roughly as follows

object missing = Type.Missing;
ie.Navigate("http://website.com", ref missing, ref missing, ref missing, ref missing);
mshtml.HTMLDocument theDoc = (mshtml.HTMLDocument)ie.Document;
mshtml.HTMLDivElement myDiv = (mshtml.HTMLDivElement)theDoc.getElementById("divID");

Now, up to this point, myDiv is a DivElement.

But, the webpage itself contains more DIV's under "divID". That is, there are many layers of nested DIVs.

But the myDIV object is of type mshtml.HTMLDivElement, which provides me with no function to retrieve more DIVS as its children.

What can I do in this case? Assuming I have more DIV's I need to retrieve in a nested fashion?

A: 

You might have already figured this out, but just in case... You should be able to cast myDiv object to IHTMLElement interface and use its 'children' property to iterate myDiv's children.

Kei