Add-in Express™ Support Service
That's what is more important than anything else

Clarification for one scenerio 
Anoop Kovoor

Posts: 19
Joined: 2012-11-06

Using add-in-express plugin, I'm trying to get all occurances of a particular element (ie abc) from a webpage and after processing, add some new elements related to the "abc" under each "abc" element.

I'm iterating through the "abc elements using the code as below:

mshtml.IHTMLElementCollection Elems = HTMLDocument.getElementsByTagName("abc");
foreach (mshtml.IHTMLElement Elem in Elems)
//The code

The clarification that I need is about the iterator that I use here be a random iterator or a sequential one. Also if the elements are iterated randomly, please provide a solution to get it sequentially..

Posted 22 Nov, 2012 04:59:55 Top
Sergey Grischenko

Add-in Express team

Posts: 7202
Joined: 2004-07-05
Hi Anoop,

I think that it is a sequential iterator. You can also use the code below:

            mshtml.IHTMLElementCollection Elems = HTMLDocument.getElementsByTagName("div");

            mshtml.IHTMLElement Elem;

            for (int i = 0; i < Elems.length; i++)
                Elem = Elems.item(null, i) as mshtml.IHTMLElement;
                if (Elem != null)
                    // to do
Posted 22 Nov, 2012 05:41:09 Top