Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grab all <H2> within certain DIV
#2
Macro Macro2762
Code:
Copy      Help
str s=
;<BODY>
;<H2>DO NOT GRAB THIS 1</H2>
;<DIV class="entry">
;,<H2>TEST 1</H2>
;</DIV>
;<DIV class="entry">
;,<H2>TEST 2</H2>
;;;;<div><H2>TEST 3</H2></div>
;</DIV>
;<H2>DO NOT GRAB THIS 2</H2>
;</BODY>

out
HtmlDoc d.InitFromText(s)
ARRAY(MSHTML.IHTMLElement) h2 div
int i j
d.GetHtmlElements(div "div")
for i 0 div.len
,str cn=div[i].className
,if cn="entry"
,,d.GetHtmlElements(h2 "h2" "" div[i].sourceIndex)
,,for j 0 h2.len
,,,out h2[j].innerText


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)