Way to get innertext of all childnodes of a node?

musicgold

New member
Local time
Today, 07:10
Joined
Dec 7, 2009
Messages
6
Hi,

Is there a way to get innerText from all childnodes of a node quickly? I am using VBA.

A web page has a node "H1" which in turn has several childnodes, some of them are "p" and some are "STRONG". I need to get the text in these nodes. I tried to use getelementsbytagname and getattribute methods, but it is getting too complex. Is there an easy way?

Thanks,

MG.
 
Have you looked at the DOM structure? I believe you have to traverse the tree by going from top down although in most cases you don't need to include the root. I think this question is more suited in the Web Design & Development section of the forum.
 
Hi,

Is there a way to get innerText from all childnodes of a node quickly? I am using VBA.

A web page has a node "H1" which in turn has several childnodes, some of them are "p" and some are "STRONG". I need to get the text in these nodes. I tried to use getelementsbytagname and getattribute methods, but it is getting too complex. Is there an easy way?

Thanks,

MG.

Once you have the get_the_element_by_tag_name("H1") then the innerHTML text will be all the text that it and all of its child nodes have.
 
Glad to be of help. I wish I was around when i was learning all this stuff about webpages and the DOM :-)
 

Users who are viewing this thread

Back
Top Bottom